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::Parser does not reject inputs that it should #4283

headius opened this Issue Nov 14, 2016 · 3 comments


None yet
2 participants
Copy link

commented Nov 14, 2016


JRuby master running updated Ruby 2.3.1 tests.

Expected Behavior

The following test was added:

  def test_wrong_inputs
    assert_raise(ParserError) { JSON.parse('"foo"') }
    assert_raise(ParserError) { JSON.parse('123') }
    assert_raise(ParserError) { JSON.parse('[] bla') }
    assert_raise(ParserError) { JSON.parse('[] 1') }
    assert_raise(ParserError) { JSON.parse('[] []') }
    assert_raise(ParserError) { JSON.parse('[] {}') }
    assert_raise(ParserError) { JSON.parse('{} []') }
    assert_raise(ParserError) { JSON.parse('{} {}') }
    assert_raise(ParserError) { JSON.parse('[NULL]') }
    assert_raise(ParserError) { JSON.parse('[FALSE]') }
    assert_raise(ParserError) { JSON.parse('[TRUE]') }
    assert_raise(ParserError) { JSON.parse('[07]    ') }
    assert_raise(ParserError) { JSON.parse('[0a]') }
    assert_raise(ParserError) { JSON.parse('[1.]') }
    assert_raise(ParserError) { JSON.parse('     ') }

Actual Behavior

We fail immediately on the first line.

@headius headius added this to the JRuby milestone Nov 14, 2016


This comment has been minimized.

Copy link
Member Author

commented Dec 13, 2016

Copy @flori since he still maintains the json library.

@headius headius modified the milestones: JRuby, JRuby Dec 13, 2016


This comment has been minimized.

Copy link

commented Dec 13, 2016

According to RFC 7159 the first two assertions are incorrect now and can be deleted.

@headius headius closed this May 15, 2018


This comment has been minimized.

Copy link
Member Author

commented May 15, 2018

Updated json gem + tests no longer has this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.