Issues with passing Flow Variable JSON Transformer Node

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:
JSON Transformer Patches
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
(token JsonToken.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.


When I load it in the Flow Variables Tab directly it works.
But still wondering why this doesnt work how I tried it in the first go…

1 Like

Thanks for posting your solution!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.