-
Notifications
You must be signed in to change notification settings - Fork 26
Description
This didn't pass through to php-internals, but it's somewhat off-topic for the PHP7 jsond RFC discussion anyway. → It's more of a feature-feasibility inquiry.
Is jsond extensible enough to somewhen support JSOL besides standard JSON?
"JSOL" is somewhat of a catchy but not widely agreed-on term. Simply meaning JavaScript Object Literals. The primary difference to JSON being unquoted object keys.
Supporting it obviously comes with the danger of encouraging its use over proper JSON. However it just happens to exist and persist in the wild. And a lot of quirky PHP userland workarounds have been concocted already to utilize it (same goes for Ruby, Python, and JavaScript of course). Just a few easy-to-google samples:
- http://php.net/manual/de/function.json-decode.php#90790 (and a few more..)
- http://stackoverflow.com/questions/4210160/safely-parsing-a-json-string-with-unquoted-keys
- http://stackoverflow.com/questions/11729051/php-reading-invalid-json-with-json-decode
- https://github.com/daepark/JSOL
- http://stackoverflow.com/questions/6836548/handling-malformed-json-in-php
- https://github.com/iamcal/Wowhead-API/blob/master/t/lib_json.php
- And
PEAR::Services_JSONbeing one of the few proper implementations with optional support for literals.
Clearly there shouldn't be json_encode() support for "JSOL". But something like a JSON_PARSE_LITERALS flag for the decoder might be desirable at some point.
Your lexing and parser tables look really tidy. So would supporting this optionally be possible at all - without harming jsonds` performance advantage in general?