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

json 2.3.1 accepts { and [ as valid JSON #453

Closed
peterkinmond opened this issue Dec 3, 2020 · 4 comments
Closed

json 2.3.1 accepts { and [ as valid JSON #453

peterkinmond opened this issue Dec 3, 2020 · 4 comments

Comments

@peterkinmond
Copy link

JSON.parse 2.3.1 accepts { and [ as valid JSON, which caused a JSON::ParserError in 2.3.0.

2.3.0

> JSON.parse('{') # => JSON::ParserError: 783: unexpected token at '{'
> JSON.parse('[') # => JSON::ParserError: 434: unexpected token at ''
> JSON.parse('') # => JSON::ParserError: 783: unexpected token at ''
> JSON.parse('{}') # => {}
> JSON.parse('[]') # => []
> JSON.parse('{{}') # => JSON::ParserError: 783: unexpected token at '{{}'

2.3.1

> JSON.parse('{') # => {}
> JSON.parse('[') # => []
> JSON.parse('') # => JSON::ParserError: source is not valid JSON!
> JSON.parse('{}') # => {}
> JSON.parse('[]') # => []
> JSON.parse('{{}') # => JSON::ParserError: unexpected token in object at '{}'!
@marcandre
Copy link
Contributor

This would indicate that there is something wrong with the test suite, as I added these tests in 5b4f1ba

@peterkinmond
Copy link
Author

@marcandre it looks like 5b4f1ba didn't get included in the 2.3.1 release:

2.3.1 lists the sha as 0951d77 which doesn't include those test files (tests/fixtures/fail29.json, etc)

@marcandre
Copy link
Contributor

marcandre commented Dec 3, 2020

Ho, right, my fix just hasn't been released yet.
I guess that when you were running it in 2.3.0 it was using the C/Java implementation, and in 2.3.1 it is using the Ruby-pure implementation, which had this bug, which was fixed by #425.
In that case, this issue can be fixed as already solved, we'll just hope for a release.

@peterkinmond
Copy link
Author

Makes sense, thanks! I'll close this issue

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

No branches or pull requests

2 participants