note 126763 added to function.json-encode
| From: | DimeCadmium at main dot php dot net | Date: | Thu, 13 Jan 2022 20:02:52 +0000 |
| Subject: | note 126763 added to function.json-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217490@lists.php.net to get a copy of this message | ||
> While most decoders will accept these values as valid JSON, some may not, as the specification
> is ambiguous on this point.
The specification (https://datatracker.ietf.org/doc/html/rfc8259#section-2) is not ambiguous,
whether you look at RFC8259, go back to RFC7159 or 7158 or 4627, look at (either edition of)
ECMA-404, or even at JSON.org.
The original RFC - from 16 years ago, mind you - specified that the root level of JSON text could
only be a object or array.
Literally every other standard - from as long as 9 years ago (RFC7158 and ECMA-404 1st Ed.) and as
recent as 5 years ago (RFC8259 and ECMA-404 2nd Ed., both current standards) - makes explicit that
any value can appear at the root.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 74.192.150.87)
----
Manual Page -- https://php.net/manual/en/function.json-encode.php
Edit -- https://main.php.net/note/edit/126763
Del: integrated -- https://main.php.net/note/delete/126763/integrated
Del: useless -- https://main.php.net/note/delete/126763/useless
Del: bad code -- https://main.php.net/note/delete/126763/bad+code
Del: spam -- https://main.php.net/note/delete/126763/spam
Del: non-english -- https://main.php.net/note/delete/126763/non-english
Del: in docs -- https://main.php.net/note/delete/126763/in+docs
Del: other reasons-- https://main.php.net/note/delete/126763
Reject -- https://main.php.net/note/reject/126763
Search -- https://main.php.net/manage/user-notes.php