Hello,
I have two XML Strings:
<note>
<to>Peter</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
and
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
I want to apply changes made to the second XML File to the first XML (and a number of n-th other XML Strings).
In the Example above, both XML Strings should have the value of <to>Peter</to>
at the end.
Below is an Example Image as well as the Workflow itself:
problems_with_json_transformer.knwf (81.3 KB)
In the top example, I am using the JSON Diff
Node to find differences between both Strings; afterwards I pasted the resulting Column from the Node to the JSON Transformer
Node to apply changes to the first XML String. Everything works fine here.
The bottom Example is the same, except I pass the Column resulting from the Diff
Node as a Flow Variable to the Transformer
Node.
As a result i get an Error from the Transformer
Node, saying:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type
java.util.ArrayList<com.github.fge.jsonpatch.JsonPatchOperation>
from String value
(tokenJsonToken.VALUE_STRING
)
at [Source: UNKNOWN; byte offset: #UNKNOWN]
I tried casting the (from Java interpreted as) JSONArrray as String with a Java Snippet
Node and transforming the JSON from [{some data}]
to {some data}
(as suggested here: java - com.fasterxml.jackson.databind.exc.MismatchedInputException: Can not deserialize instance of object out of START_ARRAY token - Stack Overflow).
Both approaches didn’t work.
Thank you.