Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How could i get json from com.apigee.flow.message.MessageContext?

Not applicable

I need to parse requested json before proceed further, i am using javacallback, but not sure how to handle with JSON...

Solved Solved
0 4 2,040
2 ACCEPTED SOLUTIONS

Not applicable

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.

View solution in original post

Not applicable

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?

View solution in original post

4 REPLIES 4