Hi,
I am facing some issues in json to xml conversion. i am guessing most of us have encountered it .
Below is my JSON structure input
{ "val": "X", "DataPoint": [{ "code": "TK", "desc": "Tickets" }, { "code": "PK", "desc": "Parking" } ] }
i am unable to extract above using extract variables - as number of nodes of "DataPoint" tag is dynamic.
How do i convert above json to xml objects of "DataPoint" ?.
Apigee is so cool when it comes to xml to json , but above scenario is very complex for me.
Can you help me please?
Note: i am having error when using tag "nodeset" (probably maybe as i am still using older version of on-premise edge)
Thanks & Best Regards
Sujith Mathew
Solved! Go to Solution.
Which thing are you using? ExtractVariables or JSONToXML ?
There are two distinct policies.
How do i convert above json to xml objects of "DataPoint" ?.
I'm not sure what you mean by "objects". But using JSONToXML you can convert the above to:
<?xml version="1.0" encoding="UTF-8"?> <Root> <val>X</val> <DataPoint> <code>TK</code> <desc>Tickets</desc> </DataPoint> <DataPoint> <code>PK</code> <desc>Parking</desc> </DataPoint> </Root>
The JSONToXML policy configuration I used for this was:
<JSONToXML name='JSONToXML-1'> <Source>request</Source> <OutputVariable>transformed.content</OutputVariable> <Options/> </JSONToXML>
Which thing are you using? ExtractVariables or JSONToXML ?
There are two distinct policies.
How do i convert above json to xml objects of "DataPoint" ?.
I'm not sure what you mean by "objects". But using JSONToXML you can convert the above to:
<?xml version="1.0" encoding="UTF-8"?> <Root> <val>X</val> <DataPoint> <code>TK</code> <desc>Tickets</desc> </DataPoint> <DataPoint> <code>PK</code> <desc>Parking</desc> </DataPoint> </Root>
The JSONToXML policy configuration I used for this was:
<JSONToXML name='JSONToXML-1'> <Source>request</Source> <OutputVariable>transformed.content</OutputVariable> <Options/> </JSONToXML>
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |