I have this json string:-
{
"mkt": {
"-st": "NSW",
"-pc": "2150",
"-lo": "PARRAMATTA",
"-pt": "U",
"-notify_by": "email",
"-notify_when": "any",
"stat": [
{
"-code": "DSR_PLUS",
"-change": "falls below",
"-val": "50"
},
{
"-code": "TV",
"-change": "rises above",
"-val": "450000"
}
]
}
}
I want to convert this as XML like this:-
<?xml version="1.0" encoding="UTF-8" ?>
<mkt st="NSW" pc="2150" lo="PARRAMATTA" pt="U" notify_by="email" notify_when="any">
<stat code="DSR_PLUS" change="falls below" val="50" />
<stat code="TV" change="rises above" val="450000" />
</mkt>
I am using this code to convert JSON string to XML:-
JSONObject o = new JSONObject(JSONSTring);
String xml = org.json.XML.toString(o);
But this is giving me wrong XMl( XML without properties)