php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80791 Support JSON With Commas and Comments (JWCC) in json_decode
Submitted: 2021-02-23 12:44 UTC Modified: 2021-02-23 15:25 UTC
From: php-bugs at xpaw dot me Assigned:
Status: Suspended Package: JSON related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
19 + 1 = ?
Subscribe to this entry?

 
 [2021-02-23 12:44 UTC] php-bugs at xpaw dot me
Description:
------------
See https://nigeltao.github.io/blog/2021/json-with-commas-comments.html for more information.

It is quite common to have trailing commas in JSON, and a lot of parsers support it. I believe this could be trivially supported by PHP, even if you skip adding support for comments.

Test script:
---------------
json_decode( '{"a":1,}', JSON_THROW_ON_ERROR );


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-23 15:25 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2021-02-23 15:25 UTC] cmb@php.net
This feature request requires discussion for which this bug
tracker is not suitable.  Please pursue the RFC process[1].  For
the time being, I'm suspending this ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC