Actions
Feature #16502
closedAdd option :allow_trailing_comma to JSON#parse
Status:
Closed
Assignee:
-
Target version:
-
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
Actions
Like0
Like0Like0Like0