java – Process single element array when converting XML to JSON ()

I’m using org.json.XML.toJSONObject() method to convert an XML string to JSON. Here is a sample XML string that I need to convert.

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

Here, ‘accounts’ is an element of an array and contains only a single element. But the org.json library cannot detect this. It can detect only if there are multiple elements.

My question is, is there a library that I can use to detect a single element array using the available tag in the XML string?

Read more here: Source link