[ruby-core:96817] [Ruby master Feature#16502] Add option :allow_trailing_comma to JSON#parse
[email protected] Sun, 12 Jan 2020 19:19:07 +0000 (UTC)
| Newsgroups | gmane.comp.lang.ruby.core |
|---|---|
| Message-ID | <redmine.journal-83812.20200112191907.60511a9bb7d64711@ruby-lang.org> |
Issue #16502 has been updated by j.spanjers (Jan-Joost Spanjers).
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).
----------------------------------------
Feature #16502: Add option :allow_trailing_comma to JSON#parse
https://bugs.ruby-lang.org/issues/16502#change-83812
* Author: j.spanjers (Jan-Joost Spanjers)
* Status: Feedback
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Hello everyone,
I'd like to be able to parse JSON sources that contain trailing commas in arrays and/or objects.
For example,
``` ruby
> JSON.parse('[1,2,3,]')
JSON::ParserError: 416: unexpected token at ']'
```
I have created a [pull request](https://github.com/ruby/ruby/pull/2831) to add the option :allow_trailing_comma to JSON#parse:
``` ruby
> 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
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>