XML to JSON producing undesired results

I’m using the


library, as seen below, to convert from XML to JSON


A simple test case shows the problem I am having, see below: –

I have the following XML


which in turn, produces

{"record": { "id": "A108B" }}

Great! The problem occurs if




Using the following code


I get

{"record": { "name": 1111 }}

I’d actually prefer to keep the values as all strings, i.e. user identifiers. I don’t want the output changing depending on whether the identifier happens to not have a character in it.

Is there any way I can force org.json to do this? I can probably fork the code and make a change for myself but I would expect that this is a problem someone else has come across and has a solution for.

Read more here: Source link