Created on 11-20-2019 08:00 PM - last edited on 11-20-2019 10:36 PM by VidyaSargur
I have JSON messages in the flowfiles, and I'm putting a subset of the JSON elements into attributes using EvaluateJSONPath. The issue is that when I use AttributesToJSON, all the elements get wrapped in quotes, so the JSON fields that are/were arrays now are just strings that happen to have square brackets in them, and quotes around the strings in the array are escaped. How do I preserve the "non-stringiness" of my JSON through these operations?
Input JSON:
{"customer_id": 1234567, "vckey_list": ["test value"]}
I pull both of those fields into attributes using EvaluateJSONPath, and then user AttributesToJSON with content-flowfile and this is the output. Obviously the strings within the array are escaped because the array itself is quoted, as is the thing that was a number.
Output JSON after 2 operations:
{"customer_id": "1234567", "vckey_list": "[\"test value\"]"}
My desired output would be identical to the original.
{"customer_id": 1234567, "vckey_list": ["test value"]}
I'm sure I've missed something simple to make these operations commute.