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

Valid json but not well formated, cloud not be parsed #138

Closed
briceruzand opened this issue Dec 21, 2016 · 12 comments
Closed

Valid json but not well formated, cloud not be parsed #138

briceruzand opened this issue Dec 21, 2016 · 12 comments

Comments

@briceruzand
Copy link

The following valid json could not be parsed by jsonview 1.2.0.

https://gist.github.com/briceruzand/2481a83e739cea80a48b0d51ba93127b

I got the following error :
expected ':' after property name in object at line 5 column 14

@bhollis
Copy link
Owner

bhollis commented Dec 21, 2016 via email

@briceruzand
Copy link
Author

Are you sure, because every jsonlint (validator) I try with that json tells it is a valid one. What is unvalid is that json ?

Thx

@bhollis
Copy link
Owner

bhollis commented Dec 27, 2016

You probably have some nonprintable character in there. I'd need to see the original document to be sure - whatever's in the Gist is valid, so it's not what JSONView is choking on.

@stanio
Copy link
Contributor

stanio commented Jan 7, 2017

Looks caused by the source tweaking done in safeStringEncodeNums() – the result becomes:

{
  "status" : "ok",
"sort_by" : "asc",
"filters" : [],
"data" : {"i"​18"n":"label"}
}

@stanio
Copy link
Contributor

stanio commented Jan 7, 2017

So this looks related to #21 / 808e99f. It fails to recognize the number is part of a string key, in the given case.

IMO, the fix for #21 should only target large integer numbers (18+ decimal digits), while it appears to match any JSON number literal (including floating point numbers).

@bhollis
Copy link
Owner

bhollis commented Jan 7, 2017 via email

@bhollis bhollis closed this as completed in de15259 Jan 8, 2017
@bhollis
Copy link
Owner

bhollis commented Jan 8, 2017

OK, it turned out to be a weird edge case in the regex to count quotes, not the number regex. I've fixed it. Sorry for doubting your issue, and thanks for sticking with it and helping fix a real bug!

@briceruzand
Copy link
Author

Thank you guys for fixing this trouble.
Will you pulish a new release shortly with that fix ?

@stanio
Copy link
Contributor

stanio commented Jan 9, 2017

I already see it available at:

https://addons.mozilla.org/addon/jsonview/versions/

Probably it awaits formal AMO approval to appear directly on:

https://addons.mozilla.org/addon/jsonview/

@bhollis
Copy link
Owner

bhollis commented Jan 9, 2017 via email

@stanio
Copy link
Contributor

stanio commented Jan 10, 2017

Unrelated... I've noticed the extension is marked that it doesn't require restart, but then JS updates don't really take effect until application gets restarted.

@briceruzand
Copy link
Author

Thx very much my ugly json stream can now be visualized.

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

No branches or pull requests

3 participants