[Web-SIG] Time a for JSON parser in the standard library?
Ian Bicking
ianb at colorstudy.com
Thu Apr 10 04:20:12 CEST 2008
Alan Kennedy wrote:
> [John]
>> Sounds like a case *for* strict parsing, in my opinion. PHP's loose
>> parsing made it difficult to figure out why the JSON was invalid. If
>> trailing comma handling is to try to work around copy-paste errors, -1
>> from me.
>
> No, the PHP lib did exactly what it should, IMHO. The PHP lib was
> liberal in what it consumed (a dangling comma), and strict in what it
> produced (no dangling comma).
>
> It accepted my broken document with a dangling-comma, and emitted a
> strictly conformant document with the offending comma removed, which
> enabled my co-worker to proceed with his job.
I prefer liberal, with an option to turn on warnings or be strict.
Potentially warnings could be turned on by default, and turned off with
the warnings module. (Is there a way to have a warning raise an
exception by default? I only know of the command-line option to the
interpreter.)
Ian
More information about the Web-SIG
mailing list