JSON to XML. No array element tags.

Not applicable

For example:

JSON:

{
"test": [{"a":"1"},{"b":"2"}]
}

If converted using apigee's built in JSON to XML policy, the output XML(simplified) will be:

XML:

<test>
   <a>1</a>
</test>
<test>
   <b>2</b>
</test>

Yet, what I want is the following:

<test>
   <a>1</a>
   <b>2</b>
</test>

I don't want "test" to repeat for each element. I can't seem to find anything in the apigee policy to do this type of conversion. Is it possible to do this?

Thank you,

Aleks

1 1 273
1 REPLY 1

@aleks1 ,

That's by design, we would like to differential between objects & arrays while converting to XML. For Example, if your JSON response is ,

{"test":{"b":"2","a":"1"}}

And if you use JSON to XML, you will get,

<?xml version="1.0" encoding="UTF-8"?>

<test>

	<a>1</a>

	<b>2</b>
</test>	

Keep us posted if you still have any queries.