I need to parse requested json before proceed further, i am using javacallback, but not sure how to handle with JSON...
Solved! Go to Solution.
You will always get a String representation of the variable when you try getVariable method. Now you can use another java library to convert to / parse as JSON objects as needed.
If I understand correctly, your payload is a JSON request. If you are interested in specific elements of the JSON, you can always use a JSONPath extraction policy and assign specific elements of the JSON as a variable in your flow. This might save you the effort of writing a java callout.
However, when your payload JSON has array and you may need to loop through the payload object, java callout or javascript is a good option.
JavaScript is particularly good for handling JSON because you do not need any additional library to handle JSON, unlike in Java. JSON is native to JavaScript. So, net-net, here is my suggestion. 1. Try using JSONpath variable extraction if you are looking for a non-array JSON in the payload. It is easier that way. 2. Otherwise write a JavaScript that would reduce programming effort for the JSON part.
When I try to iterate the JSON object in Javascript, the EDGE throws error as JSON iteration blocked. I tried it in Cloud version. Anyone has this similar issues?