stleary / JSON-java

A reference implementation of a JSON package in Java.
http://stleary.github.io/JSON-java/index.html
Other
4.54k stars 2.56k forks source link

Complete strictMode for JSONArray #887

Closed stleary closed 6 months ago

stleary commented 7 months ago

Garbage chars at the end of JSONArray docs are still allowed in strict mode. This needs to be fixed.

Here is a list of examples of JSON text strings that should be allowed in default mode, but not in strict mode. This is not an exhaustive list. Unit tests should confirm expected behavior when strictMode is true and false.

"[]asdf",
"[]]",
"[]}",
"[][",
"[]{",
"[],",
"[]:",
"[],[",
"[],{"

Note: It should not be necessary for the code to check for specific trailing chars; strict mode is violated if parsing is completed and there are still chars left in the JSONTokener instance.

rikkarth commented 7 months ago

Hi @stleary would you please be able to provide one or two examples?

stleary commented 7 months ago

Description updated

rikkarth commented 7 months ago

image

stleary commented 6 months ago

Closing due to feature accepted and merged.