Open lostsnow opened 10 years ago
good catch. can u send a PR with failing unit test and fix if possible.
Seems like var s1 = "{\"a\":2a}";
and var s2 = "[2a]";
throws the json exception but not var s = "2a";
.
The fix can be added to this line. https://github.com/facebook-csharp-sdk/simple-json/blob/e2528f3776b2e280c135ab92b4b4ca447f891b9c/src/SimpleJson/SimpleJson.cs#L548
If the index
is less then charArray.Length
means we haven't completed parsing the json string and should set obj
to null and return false.
Seems like var s = "\"a\"2";
also doesn't throw json exception.
Reproduce code:
Expected result:
throw Invalid JSON string Exception
Actual result:
2