You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Define two strings "[1 2 3]" and "{\"key1\" \"val1\" \"key2\" \"val2\"}"
2. Pass the strings to org.json.simple.parser.JSONParser.parse()
3. No ParseException will be raised, the parser returns a valid JSONArray /
JSONObject.
What is the expected output? What do you see instead?
JSON arrays and objects have their values/key-value pairs separated by
commas. The parser, however, seems also to accept tokens that are separated
by space only. The same happens to the ":" operator for object key-value pairs.
What version of the product are you using? On what operating system?
JSON.simple 1.1 / Java 1.6 / Linux
Please provide any additional information below.
Original issue reported on code.google.com by vladimir...@gmail.com on 5 Jan 2010 at 1:35
Yes, JSON.simple has a broader allowed inputs other than the spec. That is not a
violation of the spec (see
http://code.google.com/p/json-simple/wiki/DecodingExamples#Notes_-_Multithreadin
g_and_extensions
and relevant comments).
But it's useful to add a "strict" mode to the parser to support the validation
of inputs.
Thanks.
Original comment by fangyid...@gmail.com on 6 Jan 2010 at 12:10
I thank you for this clarification. I've been using JSON.simple for quite some
time
and only now I did find out about this special behaviour. I discovered the
"bug" when
I wrote a small client app for querying and testing JSON-RPC 2.0 servers. There
I use
the library to validate and parse JSON input directly by the user.
Anyhow, while it would be nice to have a strict mode, I can also happily live
with this.
Original comment by vladimir...@gmail.com on 6 Jan 2010 at 9:14
Original issue reported on code.google.com by
vladimir...@gmail.com
on 5 Jan 2010 at 1:35Attachments:
The text was updated successfully, but these errors were encountered: