XML to JSON conversion: empty array instead of empty string
<p>I'm using the library net.sf.json to convert an XML to a JSON. 
This is the code I wrote:</p>

<pre><code>FileInputStream fis = new FileInputStream("C:\\Desktop\\TestXML.xml");

XMLSerializer xmlSerializer = new XMLSerializer();

JSON json = xmlSerializer.readFromStream(fis);

JSONArray jsonArray = new JSONArray();
jsonArray.add(json);

JSONObject root = new JSONObject();
root.element("WSJson", jsonArray);
</code></pre>

<p>I noticed that if the XML contains empty tags, they are transformed in empty arrays. </p>

<p>Example: given this xml</p>

<pre><code>&lt;WSJson&gt;
    &lt;Tipo_Operazione&gt;I&lt;/Tipo_Operazione&gt;
    &lt;Codice_Prestazione&gt;SW1&lt;/Codice_Prestazione&gt;
    &lt;Codice_Intervento&gt;&lt;/Codice_Intervento&gt;
    &lt;Nome/&gt;
&lt;/WSJson&gt;
</code></pre>

<p>the output is</p>

<pre><code>{
    "WSJson": [{
        "Tipo_Operazione": "I",
        "Codice_Prestazione": "SW1",
        "Codice_Intervento": [],
        "Nome": []
    }]
}
</code></pre>

<p>Instead, I would like to have</p>

<pre><code>{
    "WSJson": [{
        "Tipo_Operazione": "I",
        "Codice_Prestazione": "SW1",
        "Codice_Intervento": "",
        "Nome": ""
    }]
}
</code></pre>

<p>Can anyone help?</p>