I am not able to convert json array into xml

Not applicable

I add json-to-xml policy. but its not showing json into xml format. i cleared cache also but still no use.please help me

please check below url

http://amruta-trial-test.apigee.net/getmpinservice

and also check response that need to be converted into xml format

{"message":"Error occured","status":"false"}
0 9 298
9 REPLIES 9

@Amruta Patil, Could you attach your proxy and also sample JSON payload which you are trying to convert in to XML?

Not applicable

@Amruta Patil, can you please send me the code you have written for JSON-to-XML policy

Please check

5782-jsontoxml.png

@Amruta Patil - along with the code folks have asked, can you share both the sample JSON you want to convert and the sample XML output so that we can help you with the policy code snippet ? Just reaching out with little info wont help.

Not applicable

@Amruta Patil, what is the http content-type header of the source field( in your case its response). It should be application/json for the policy to work.

Also can u start the trace session and look at the response variable?

Also is th policy failing with some error or is it just executing and not giving any output...?

No its not giving any error

Not applicable

@Amruta Patil,

There could be two possible issues:

1. Content-type header of the source message must be set to application/json

2. "Source" element has been defined as 'response'. Does the 'response' has JSON data?

If above point don't resolve the issues, could you attach snapshot of the trace.

Regards,

Rajesh Doda

I am not able to find Content-type. can u please tell me where its exactly

@Amruta Patil, you should see it in the trace session. If you are not able to see it, please use a javascript policy to print the response variable. Put the following statement in your javascript policy,

print(JSON.stringify(response));