Show HN: Pretty print invalid JSON (or anything that looks sort of like JSON) (prettyprintplease.com) 9 points by jastr 4y ago ↗ HN
[–] jastr 4y ago ↗ Hi HN! This was a python script I used on the command line for a while, before spending a weekend converting it to a microsite.Pretty print json with single quotes or None or anything that looks like json, like python dictionaries/arrays or anything that PHP can spit out.
[–] shmoogy 4y ago ↗ Saving this for later - was going to try to make something like this for when I get invalid json and have to spend a bit figuring out what is wrong.Thanks
[–] eduardosasso 4y ago ↗ Good idea. Suggestion add some examples there so people can see what it looks like when you have broken data.
[–] savy91 4y ago ↗ It doesn't work too well wish some actual valid jsons:Input:{"somekey": "value", "someother": "value,value,value"}Output:{ "somekey": "value", "someother": "value, value, value" }Seems like the problem is with commas being converted to ,\n regardelss of them being inside a valid string.
4 comments
[ 3.6 ms ] story [ 23.1 ms ] threadPretty print json with single quotes or None or anything that looks like json, like python dictionaries/arrays or anything that PHP can spit out.
Thanks
Input:
{"somekey": "value", "someother": "value,value,value"}
Output:
{
}Seems like the problem is with commas being converted to ,\n regardelss of them being inside a valid string.