[RFC] Opt-in JSON Comments and Trailing Commas

From: Date: Tue, 13 Oct 2026 18:36:13 +0000
Subject: [RFC] Opt-in JSON Comments and Trailing Commas
Groups: php.internals 
Request: Send a blank email to internals+get-132868@lists.php.net to get a copy of this message
Hello internals, I want to start the discussion of the RFC "Opt-in JSON Comments and Trailing Commas": <https://wiki.php.net/rfc/json_comments_trailing_commas> The RFC adds two independent opt-in flags for json_decode() and json_validate(): - JSON_ALLOW_COMMENTS accepts // line comments and /* block comments */. - JSON_ALLOW_TRAILING_COMMAS accepts one comma after the last item of a non-empty array or object. Strict JSON stays the default. json_encode() does not change. This RFC follows the pre-RFC thread: <https://news-web.php.net/php.internals/132236> Thank you for the feedback in that thread. The RFC now answers it: - The RFC does not add JSON5. It compares the two flags with JSON5, JSONC and JWCC (Larry, Anton). - The RFC keeps two flags, not one JSON_ALLOW_JSONC flag. The JSONC specification is a draft, and it makes trailing commas optional. The section "Rejected Features" gives all reasons (Tim). - The RFC includes test results and performance measurements. The implementation is here: <https://github.com/php/php-src/pull/23336> The RFC has two primary votes, one for each flag. Each vote needs a 2/3 majority. All feedback is welcome. Otar

« previous php.internals (#132868) next »