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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php-bugs at xpaw dot me
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 15:01:34 2025 UTC