0
votes

I have a XML which I am trying to convert into JSON. XML is like below

let $config := json:config("custom") 
let $x := 
    <results>
        <result>
          <a></a>
          <b></b>
        </result>
        <result>
          <a></a>
          <b></b>
        </result>
     </results>
return
   json:transform-to-json($x,$config)

the above code is return me the json format only with one child result element(the last one). How can I transform the xml to json with two child result elements?

1

1 Answers

0
votes

The default behavior of the custom transform does not anticipate repeating element, but you can configure the custom transform. It is explained in more detail in this answer: https://stackoverflow.com/a/26866189/918496

HTH!