How to treat an element as an array always while using XMLToJSONpolicy

amar333n
Participant III

I have the following xml structure.

<a>
  <b>
    <c>cValue</c>
    <d>dValue</d>
  </b>
</a>

While using XMLToJSON policy , I'm getting the element 'c' as an object, but I want it to be an array.

Is there any option in XMLToJson to treat an element as an array always?

Note: I have used TreatAsArray option which didn't worked.

0 4 270
4 REPLIES 4

@Amar N

Please post your XML2JSON policy code to better understand same. I feel, Above question is not complete.

nmallesh
Participant V

@Anil Sagar according to my understanding, the following is required.

{
  "a": {
    "b": {
      "c": ["cValue"],
      "d": ["dValue"]
    }
  }
}

@Amar N confirm the same.

@Nisha Mallesh , I am specifically asking about policy xml code.

@Amar N ,

Keep it clear and concise.
Other users will only be able to help you if you provide enough details and are clear about your question. Use the body field to provide the details of your question.

Is this is a technical product question, please include:

  1. What are you doing?
  2. What are you seeing?
  3. What are you expecting to see?

What version of Apigee Edge are you using? The TreatAsArray is available in the Apigee Edge SaaS, currently. I believe you need 16.01.06 or 16.05.05 or 16.09.00 to get this feature in Apigee Edge on-premises software.