wecoppens / json-smart

Automatically exported from code.google.com/p/json-smart
0 stars 0 forks source link

Issue with json validation/parse and quotes #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Execute this code

String test = 
"[{\"key\":\"value\",\"newKey\":[{\"\"tabKey\":[\"tab1\",\"tab2\"]}]}]";
System.out.println(JSONValue.isValidJson(test));
System.out.println(JSONValue.isValidJsonStrict(test));
JSONParser parser = new JSONParser(JSONParser.MODE_RFC4627);
System.out.println("MODE_RFC4627     : " + parser.parse(test));
parser = new JSONParser(JSONParser.MODE_STRICTEST);
System.out.println("MODE_STRICTEST   : " + parser.parse(test));
parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
System.out.println("MODE_JSON_SIMPLE : " + parser.parse(test));
parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
System.out.println("MODE_PERMISSIVE  : " + parser.parse(test));

What is the expected output? What do you see instead?

An exception should be thrown somewhere and I think both methods isValidJson() 
and isValidJsonStrict() should return false.

This is the output:

true
true
MODE_RFC4627     : [{"newKey":[{"":["tab1","tab2"]}],"key":"value"}]
MODE_STRICTEST   : [{"newKey":[{"":["tab1","tab2"]}],"key":"value"}]
MODE_JSON_SIMPLE : [{"newKey":[{"":["tab1","tab2"]}],"key":"value"}]
MODE_PERMISSIVE  : [{"newKey":[{"":["tab1","tab2"]}],"key":"value"}]

As you can see, tabKey does not appear, just nothing instead. 

When I put ""tabKey" in the string, nothing appear, if I put "tabKey"", it 
works normally (tabKey appears). But in both case, we should have false, false 
+ exception.

What version of the product are you using? On what operating system?

Version 1.1.1 / Win7

Please provide any additional information below.

Original issue reported on code.google.com by cp.harm...@gmail.com on 28 Jun 2013 at 8:58

GoogleCodeExporter commented 8 years ago

Original comment by uriel.chemouni on 30 Jul 2013 at 6:17

GoogleCodeExporter commented 8 years ago
thx for report

Original comment by uriel.chemouni on 30 Jul 2013 at 6:57

GoogleCodeExporter commented 8 years ago
Is this part of the current RC?

Original comment by atr...@gmail.com on 22 Oct 2013 at 6:52

GoogleCodeExporter commented 8 years ago
simply use the latest version.

Original comment by uriel.chemouni on 23 Oct 2013 at 8:37