how to convert a JSON array to XML

I want to extract Json array from json payload and build an xml request with the same number of blocks as json array contains. How to do that?

0 3 666
3 REPLIES 3

Not applicable

first, use the extract variable policy to get the json array and next on the same use json to xml policy to get the xml presentation.

You can extract either all of the JSON payload or some jsonpath derived subset into a flow variable using the ExtractVariables policy.

https://docs.apigee.com/api-platform/reference/policies/extract-variables-policy

Use a JSON online parser if you want to work on your jsonpath expression

http://jsonpath.com/

The JSONtoXML policy converts any JSON, either the entire JSON payload or the result of the jsonpath expression to XML

https://docs.apigee.com/api-platform/reference/policies/json-xml-policy

There are handful of options if you need to transform the JSON considerably before converting it to XML. One of my favorite ways of manipulating JSON is here

https://github.com/mdunker/JSMapr

Can you give a specific example?