Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Strings, numbers, null as top level objects should throw a warning, not an error #2

Open
umbrae opened this issue Jun 29, 2011 · 3 comments

Comments

@umbrae
Copy link
Owner

umbrae commented Jun 29, 2011

Essentially all JSON libraries respect these values as top level objects, even if the spec technically prohibits. We should follow suit.

@tonextone
Copy link

'1', '"a"', 'null', 'true' and 'false' are valid JSON, according to the spec (http://www.json.org/) .

But, http://jsonlint.com/ can't parse these.

Parse error on line 1:
1
^
Expecting '{', '['

"pure JavaScript version" is ok : http://zaach.github.com/jsonlint/

@umbrae
Copy link
Owner Author

umbrae commented Jun 16, 2012

From the spec at http://www.ietf.org/rfc/rfc4627.txt:

A JSON text is a serialized object or array.
JSON-text = object / array

It should still show a warning though.

@tonextone
Copy link

Ah, I have been misunderstood.

http://jsonlint.com/ is right.

Thanks.

umbrae pushed a commit that referenced this issue Aug 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants