Re: New JSON parser
| From: | Jakub Zelenka | Date: | Sat, 15 Mar 2014 19:07:33 +0000 |
| Subject: | Re: New JSON parser | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73179@lists.php.net to get a copy of this message | ||
On Thu, Mar 13, 2014 at 10:37 PM, Marco Schuster <marco+php@m-s-d.eu> wrote:
>
> At least for the decoding part, it might be worth to look at the
> "Improving JSON" proposal (http://bolinfest.com/essays/json.html).
> tl;dr: support trailing or automatic line-end commas, //-style
> comments and keys not wrapped in "s, basically extend JSON syntax to
> ES5.
>
> I think it would be really cool if the new parser could (maybe with a
> option "JSON_NO_STRICT_PARSING") implement these enhancements to ease
> hand-writing of JSON files.
>
>
The current implementation doesn't introduce any changes from the user
point of view (except improved performance :) ). I want to keep it simple
and not over complicate the proposal. I am sure that we can discuss further
improvements if the new parser is accepted to the core. However it will
require a new RFC and thread... :)
Also, will end-users be able to get the JSON parser error message?
> Currently, all you get is a NULL returned when you have a parse error
> somewhere in your JSON - and it's a nightmare to debug with this.
>
>
You can get some info using json_last_error(_msg). However it's not very
useful because you can't identify the position of the error. I plan to
improve that but again it's not gonna be in the current proposal.
To sum it up. There are NO changes for PHP users! This is just internal
change... ;)
Thanks
Jakub