TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Pretty print invalid JSON (or anything that looks sort of like JSON)

9 pointsby jastrover 3 years ago

4 comments

savy91over 3 years ago
It doesn&#x27;t work too well wish some actual valid jsons:<p>Input:<p>{&quot;somekey&quot;: &quot;value&quot;, &quot;someother&quot;: &quot;value,value,value&quot;}<p>Output:<p>{<p><pre><code> &quot;somekey&quot;: &quot;value&quot;, &quot;someother&quot;: &quot;value, value, value&quot; </code></pre> }<p>Seems like the problem is with commas being converted to ,\n regardelss of them being inside a valid string.
shmoogyover 3 years 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.<p>Thanks
jastrover 3 years 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.<p>Pretty print json with single quotes or None or anything that looks like json, like python dictionaries&#x2F;arrays or anything that PHP can spit out.
eduardosassoover 3 years ago
Good idea. Suggestion add some examples there so people can see what it looks like when you have broken data.