| Issue 154: | how to convert JsonObject to JSONString()? | |
| 4 people starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
call JsonObject.toString() result is not a realy JSONString
because some char is not quoted!!!
Gson gson = new Gson();
JsonParser p = new JsonParser();
JsonElement r = p.parse("{\"text\":\"good\\n after\\nnoom\"}");
JsonObject ob = r.getAsJsonObject();
r.toString() \\ espect {"text":"good\\n after\\nnoom\"} but {"text":"good
after
noom\"}
|
||||||||||
,
Sep 23, 2009
Issue 157 has been merged into this issue. |
|||||||||||
,
Sep 23, 2009
I will create a change to fix this to at least use the basic escaping according to
the JSON spec.
Since the Gson object can be configured to do extra escaping (i.e. HTML, JS, etc.),
you can always use the following method to generate valid JSON from some JsonElement
object:
{@link Gson#toJson(JsonElement)}
Status: Accepted
Owner: joel.leitch |
|||||||||||
,
Sep 23, 2009
Fix submitted with r446.
Status: Fixed
|
|||||||||||
,
Sep 23, 2009
Issue 107 has been merged into this issue. |
|||||||||||
| ► Sign in to add a comment | |||||||||||