JSONovich / jsonovich

A webextension for Firefox. Pretty-prints JSON content in the browser for easy, unobtrusive viewing.
https://addons.mozilla.org/firefox/addon/jsonovich/
Mozilla Public License 2.0
7 stars 3 forks source link

Better handling of malformed JSON #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by W.Elwoo...@gmail.com on 11 Nov 2013 at 9:35