$ bundle exec ruby -rjson/pure -e 'p JSON.dump({"a" => 1}, strict: true)'
/home/eregon/code/json/lib/json/pure/generator.rb:358:in `block in json_transform': Integer not allowed in JSON (JSON::GeneratorError)
from /home/eregon/code/json/lib/json/pure/generator.rb:353:in `each'
from /home/eregon/code/json/lib/json/pure/generator.rb:353:in `json_transform'
from /home/eregon/code/json/lib/json/pure/generator.rb:337:in `to_json'
from /home/eregon/code/json/lib/json/pure/generator.rb:289:in `generate'
from /home/eregon/code/json/lib/json/common.rb:306:in `generate'
from /home/eregon/code/json/lib/json/common.rb:627:in `dump'
from -e:1:in `<main>'
It was added in https://github.com/flori/json/pull/519 but with too few tests so they didn't catch this bug.
@byroot / @casperisfine Could you fix this?
In this repo:
But of course Integer should be allowed.
The bug seems clear when looking at https://github.com/flori/json/blob/4f876a8bf7c45972800bae5bdbaf892aa2f714a5/lib/json/pure/generator.rb#L357-L363 https://github.com/flori/json/blob/4f876a8bf7c45972800bae5bdbaf892aa2f714a5/lib/json/pure/generator.rb#L400-L406
It was added in https://github.com/flori/json/pull/519 but with too few tests so they didn't catch this bug. @byroot / @casperisfine Could you fix this?