Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of malformed JSON #18

Open
GoogleCodeExporter opened this issue Mar 13, 2015 · 1 comment
Open

Better handling of malformed JSON #18

GoogleCodeExporter opened this issue Mar 13, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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 W.Elwoo...@gmail.com on 3 Jun 2011 at 10:21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants