Use #text on JSON to convert on XML using Json.org



I'm converting a json string into a XML by using json.org, everything is ok about this because I know how to use the library but I have a problem, I'd like to be able to convert from JSON to XML something like this:


XML:



<ocs:price exponent="-1">2</ocs:price>


JSON:



"ocs:price": {
"-exponent": "-1",
"#text": "2"
}


If I use json.org with this I'm getting the following when I have everything converted to XML:



<ocs:price>
<#text>2</#text>
<exponent>-1</exponent>
</ocs:price>


That's not what I'm looking for, How could convert <ocs:price exponent="-1">2</ocs:price> into a JSON value string for JSON.org library?


Regards.


No comments:

Post a Comment