[PHP-DEV] [RFC] Opt-in JSON Comments and Trailing Commas

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

Hi

On 10/13/26 20:36, Otar Chekurishvili wrote:

- 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).

I'm not happy, but the rejected is well-argued :slight_smile:

-----

I've given the RFC a full read and don't have any (other) comments. The RFC is incredibly well-written, thank you!

Just don't forget to add the link to the discussion thread at the header section: php.internals: [RFC] Opt-in JSON Comments and Trailing Commas

Best regards
Tim Düsterhus

On Tue, Oct 13, 2026, at 1:36 PM, Otar Chekurishvili wrote:

Hello internals,

I want to start the discussion of the RFC "Opt-in JSON Comments and
Trailing Commas":
PHP: 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:
php.internals: [Pre-RFC] Opt-in JSON comments and trailing commas

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:
JSON: Add opt-in comments and trailing comma flags by otar · Pull Request #23336 · php/php-src · GitHub

The RFC has two primary votes, one for each flag. Each vote needs a 2/3
majority.

All feedback is welcome.

Otar

I am forced to agree with Tim. This is a very tight RFC, and I have no remaining objections to it. Nicely done!

--Larry Garfield

Hi,

I intend to open the vote on this RFC on Monday, 2 November 2026, at 12:00 UTC. The vote will end on Monday, 16 November 2026, at 12:00 UTC.

There are two primary votes, one for each flag. Each vote needs a 2/3 majority.

Otar

On October 30, 2026, Larry Garfield larry@garfieldtech.com wrote:

On Tue, Oct 13, 2026, at 1:36 PM, Otar Chekurishvili wrote:

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

I am forced to agree with Tim. This is a very tight RFC, and I have no remaining objections to it. Nicely done!

–Larry Garfield

Hi,

I postpone the vote that I announced for today.

Jakub commented on the PR:
https://github.com/php/php-src/pull/23336

I want to answer this concern and document it in the RFC first.

I will send a new intent to vote later.

Otar

On October 30, 2026, Otar Chekurishvili otar@hey.com wrote:

Hi,

I intend to open the vote on this RFC on Monday, 2 November 2026, at 12:00 UTC. The vote will end on Monday, 16 November 2026, at 12:00 UTC.

There are two primary votes, one for each flag. Each vote needs a 2/3 majority.

Otar

On October 30, 2026, Larry Garfield larry@garfieldtech.com wrote:

On Tue, Oct 13, 2026, at 1:36 PM, Otar Chekurishvili wrote:

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

I am forced to agree with Tim. This is a very tight RFC, and I have no remaining objections to it. Nicely done!

–Larry Garfield

Hi,

I updated the RFC to version 1.1. The new section “Future parser optimisations” documents Jakub’s concern from the PR and his answer: https://github.com/php/php-src/pull/23336#issuecomment-6656465546

After the cooldown period I will send a new intent to vote.

Otar

On November 2, 2026, Otar Chekurishvili otar@hey.com wrote:

Hi,

I postpone the vote that I announced for today.

Jakub commented on the PR:
https://github.com/php/php-src/pull/23336

I want to answer this concern and document it in the RFC first.

I will send a new intent to vote later.

Otar

On October 30, 2026, Otar Chekurishvili otar@hey.com wrote:

Hi,

I intend to open the vote on this RFC on Monday, 2 November 2026, at 12:00 UTC. The vote will end on Monday, 16 November 2026, at 12:00 UTC.

There are two primary votes, one for each flag. Each vote needs a 2/3 majority.

Otar

On October 30, 2026, Larry Garfield larry@garfieldtech.com wrote:On Tue, Oct 13, 2026, at 1:36 PM, Otar Chekurishvili wrote:

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

I am forced to agree with Tim. This is a very tight RFC, and I have no remaining objections to it. Nicely done!

–Larry Garfield