Removing quotation marks in JSONObject

Posted by Spike Williams on Stack Overflow See other posts from Stack Overflow or by Spike Williams
Published on 2010-06-01T18:24:23Z Indexed on 2010/06/01 18:33 UTC
Read the original article Hit count: 221

Filed under:
|

I'm using the net.sf.json.JSONObject to create some data to be sent to a front end application, and I don't like the ways ts adding quotation marks to every field name.

For example:

 myString = new JSONObject().put("JSON", "Hello, World!").toString();

produces the string {"JSON": "Hello, World"}.

What I want it to return is {JSON: "Hello, World"} - without quotes around "JSON". What do I have to do to make that happen?

© Stack Overflow or respective owner

Related posts about java

Related posts about JSON