Feature #16502
closedAdd option :allow_trailing_comma to JSON#parse
Description
Hello everyone,
I'd like to be able to parse JSON sources that contain trailing commas in arrays and/or objects.
For example,
> JSON.parse('[1,2,3,]')
JSON::ParserError: 416: unexpected token at ']'
I have created a pull request to add the option :allow_trailing_comma to JSON#parse:
> JSON.parse('[1,2,3,]', allow_trailing_comma: true)
[1, 2, 3]
I would kindly like to ask you to consider this patch for merging in Ruby core.
Regards,
Jan-Joost Spanjers
[1] https://github.com/ruby/ruby/pull/2831
Updated by mame (Yusuke Endoh) over 5 years ago
- Status changed from Open to Feedback
The json library has another upstream repository: https://github.com/flori/json
Could you please send a pull request to them?
Updated by j.spanjers (Jan-Joost Spanjers) over 5 years ago
mame (Yusuke Endoh) wrote:
The json library has another upstream repository: https://github.com/flori/json
Could you please send a pull request to them?
Thank you for your feedback. I have created a new pull request (https://github.com/flori/json/pull/401) upstream.
Updated by mame (Yusuke Endoh) over 5 years ago
- Status changed from Feedback to Closed
Thanks! If the pull request is merged, it will be backported to ruby/ruby. So I close this ticket.