Skip to content
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

Detect and reject trailing commas #26

Open
richfitz opened this issue Aug 22, 2019 · 2 comments
Open

Detect and reject trailing commas #26

richfitz opened this issue Aug 22, 2019 · 2 comments

Comments

@richfitz
Copy link
Member

They are not valid JSON and so should not be permitted. jsonlite doesn't care, and nor does passing them directly through to V8

@aismaniotto
Copy link

Can you let a little bit more clear? Has some example?

@richfitz
Copy link
Member Author

Trailing commas in arrays or objects are valid JavaScript but not valid JSON. For example:

[1, 2, ]

and

{
  "a": 1,
  "b": 2,
}

are not valid json (https://jsonlint.com) but can be passed into jsonvalidate because it never actually parses inputs as json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants