The Daily Commit · Section Edition Front Page PHP AI Dev EN DE FR ES

The Php Times

RFC Watch — Ecosystem

PHP proposal would add separate switches for relaxed JSON input


An RFC under discussion proposes separate opt-in flags for comments and trailing commas in PHP's json_decode() and json_validate().

PHP INTERNALS ([RFC]/[VOTE]), October 13, 2026 curated by Sönke

JSON_ALLOW_COMMENTS would accept line and block comments, while JSON_ALLOW_TRAILING_COMMAS would allow a final comma in non-empty arrays or objects. Strict JSON would remain the default, and json_encode() would be unchanged.

Otar Chekurishvili has opened a PHP Internals discussion for the proposal. It follows an earlier pre-RFC thread and remains under discussion.

JSON_ALLOW_COMMENTS would permit // line comments and /* block comments */ in input handled by json_decode() and json_validate(). JSON_ALLOW_TRAILING_COMMAS would accept one comma after the final item in a non-empty array or object. Strict JSON remains the default. json_encode() is outside the change.

The RFC compares the proposal with JSON5, JSONC and JWCC. JSONC is still a draft specification, and its treatment of trailing commas is optional. A single JSON_ALLOW_JSONC flag appears among the rejected features. The document also includes test results and performance measurements.

The implementation is available in php-src pull request 23336. Voting is split into two primary votes, one for each flag, and each vote requires a two-thirds majority. Tim Düsterhus called the reasoning behind the rejected JSONC flag solid and the RFC itself well written. He also asked for the discussion-thread link to be added to its header.

Read the original source ↗

Rate this article: 0

Readers’ Forum

No contributions yet — open the debate.

← Ecosystem — Page B1

"All the Code That's Fit to Ship" · The Daily Commit · Screen edition · Imprint · Privacy Policy