SaikatMostofa / json-simple

Automatically exported from code.google.com/p/json-simple
Apache License 2.0
0 stars 0 forks source link

[PATCH] Missing quotes around toString() output when writing an unsupported object. #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use JSONValue.writeJsonString() or JSONValue.toJsonString() providing a 
value argument of an unsupported type.

What is the expected output? What do you see instead?
 the library already provides a fallback mechanism that outputs value.toString() when passing an unsupported object. This is okay, but i would expect to get surrounding quotes, as when writing normal Strings.

What version of the product are you using?
 trunk (same behavior on 1.1)

The attached patch should solve the issue: it simply uses the same behavior for 
String instances (escape + surrounding quotes), and for the fallback case as 
well.

thanks,
alberto

Original issue reported on code.google.com by sanita.c...@gmail.com on 4 Aug 2010 at 7:13

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks.

Original comment by fangyid...@gmail.com on 5 Aug 2010 at 12:15