Validate JSON when there's a parsing error #8

Closed
bhollis opened this Issue Oct 1, 2011 · 8 comments

Comments

2 participants
Owner

bhollis commented Oct 1, 2011

Either link to JSLint or embed a JSON validator that can give real error messages.

@ghost

ghost commented Sep 23, 2012

I'd love to see this but even if you could highlight parts that are invalid it would help greatly with figuring out why a file doesn't view. Maybe a "relaxed" mode could be selected that shows files somewhat pretty even with invalid JSON. I have some files that should be JSON but aren't correct and they're quite large (250K) so when I open them and they don't work I'm stuck with a real headache trying to sift thru and find out what's wrong. Bold or Red marked areas would make this so much easier to fix. Thanks.

edit: Oh, I see now that it's not supporting unicode strings. I guess that's at least part of the problem. Any possibility to add support?

@ghost

ghost commented Sep 23, 2012

Having explored this a bit further I see now that my file is not truly a JSON file. It only looks similar. It's actually a Python AST format which has a few small differences designed just to make us go syntax crazy.

Well, a Python object view extension or mode seems to be warranted then.

Differences I noticed are:

  • single quotes strings
  • Capitalized booleans (True not true, False not false)
  • Possible None values which would be "None" in JS
  • Unicode strings eg. u"text"
Owner

bhollis commented Sep 24, 2012

JSONView does support unicode, but just in regular strings, not Python crazy-format. You could fork JSONView and build your own Python-format-viewer extension though.

@ghost

ghost commented Sep 24, 2012

Not a bad idea. I'd probably implement it as a preference as I wouldn't want to have two separate viewers and I can see still wanting JSON.

Owner

bhollis commented Sep 24, 2012

I'd make a completely new extension that you can distribute. Anyway, it's not JSON, so you'll need to look for a different MIME type.

could JSONView indicate that there is an error? i've hit a bug in MOXy and it's taken me a week to realize that JSONView is throwing away duplicated object members. Thanks

Owner

bhollis commented Dec 12, 2013

If there is an actual error that Firefox's JSON parser can detect, we show it. We get no visibility into things like repeated object keys.

ok, thanks

@bhollis bhollis closed this in e33c5b6 Jun 5, 2014

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