-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Exceptions Occur with Invalid JSON String #5
Comments
I actually think it is better to be liberal with input and conservative with the output. Is there any case in which it is necessary to actually check for this? I can't think of any practical cases. |
no read the code there are no commas and it was still parsing |
I will try to add a new method in the JSONParser which will validate JSON according to format definition. |
Fixed with newest commit. This code will now throw a JSONParseException: JSONParser parser = new JSONParser();
System.out.println("Done:" + parser.parse("{\"key\":1 \"key\":2}", true)); |
Original issue found here and still persists in current library:
fangyidong/json-simple#16
Test code no exceptions occur when it should occur:
https://pastebin.com/nq0CfHjX
Test 2 this is an invalid json string due to a dupe key when parsing. It''s fine if you want to replace a key using JSONObject.pu() in memory but, when parsing it from a file/invalid sting if they key already exists in that file/string then it is no longer acceptable
The text was updated successfully, but these errors were encountered: