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

No pretty-printing of an apparently very simple JSON file (file provided for testing purposes) #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Open the doesnotwork.json file (in attachment) in Firefox with JSONovich 
enabled.

What is the expected output? What do you see instead?
It should have been pretty-printed. Here, the content is not pretty-printed.

What version of the product are you using? On what operating system?
JSONovich v1.9.6.1 on Firefox v25 and MS Win v8.

Please provide any additional information below.
Compare with the works.json file (in attachment). It works. Thanks in advance!

Original issue reported on code.google.com by davidbou...@gmail.com on 11 Nov 2013 at 8:53

Attachments:

GoogleCodeExporter commented 9 years ago
Unfortunately, doesnotwork.json is not valid JSON. There is a trailing comma in 
the "main" array which causes Firefox's built-in strict JSON parser to throw an 
"unexpected character" error (JSON is not JavaScript, where this would be 
allowed).

I had been meaning a long time ago to replace that parser with a more forgiving 
one that would also display those sorts of syntax errors nicely, but time was 
against me.

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

GoogleCodeExporter commented 9 years ago
Thanks a lot for your quick feedback. As follow-up to your comment, I think 
that ensuring strict JSON conformance is a nice feature, not a bug, therefore 
you should keep using Firefox built-in parser, IMHO.

However, would it be possible to modify the current behavior, that is, 
JSONovich silently ignoring a file which is not strictly conforming to JSON 
standards? For example, JSONovich could simply produce as output the Firefox 
console error, instead. I think this would add a great feature: detecting 
syntax errors.

Thanks in advance for your attention.

Original comment by davidbou...@gmail.com on 12 Nov 2013 at 8:49