|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81109 JSON_UNQUTED_KEYS
Submitted: 2021-06-05 10:10 UTC Modified: 2021-06-05 11:03 UTC
From: engineering dot drmax24 at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: json (PECL)
PHP Version: 8.0.7 OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-06-05 10:10 UTC] engineering dot drmax24 at gmail dot com
Can you please:
1. add an option to send unquoted keys smth like JSON_UNQUTED_KEYS.
2. make json_decode to be able to decode json with unquoted keys. Now json_decode returns null if given a specification-correct json with no key quotes.

Json specification allows keys to be unquoted. If json keys are unquoted this saves up to 5-25% of json file size. 5-25% is a lot. 

This is a bit similar to JSON_UNESCAPED_UNICODE. If you send non-latin json safe chars with your utf8 webserver this is a big overhead in json file size. 5-25% too.

Test script:

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-05 10:53 UTC]
The JSON specification does not allow unquoted keys therefore this is a request to produce invalid output.
 [2021-06-05 11:03 UTC]
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-06-05 11:03 UTC]
> Json specification allows keys to be unquoted.

No, see <>.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 17:03:35 2021 UTC