Skip to content

Better handling of malformed JSON #18

Open
@GoogleCodeExporter

Description

@GoogleCodeExporter
Currently any JSON that can't be parsed is simply dumped into the output raw 
with no indication as to the problem.

It would be better if we could detect exactly what's wrong with the invalid 
JSON and report that to the user. I thought about using JSONlint but can't see 
any visible licensing, so built my own JSON parser using PEG.js - seems to have 
more user-friendly error messages even if it is a bit slower (shouldn't be a 
problem once we're formatting asynchronously and as long as we only run it for 
invalid JSON) and larger.

Detecting problems in JSON-P on the other hand seems to require a full 
JavaScript parser, and that bloats our XPI significantly (even my feeble 
attempt at just the secure JSON-P suggested at json-p.org enlarges the JSON 
parser five-fold).

Original issue reported on code.google.com by [email protected] on 3 Jun 2011 at 10:21

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions