Hacker News new | comments | show | ask | jobs | submit login
Show HN: A privacy-focused JSON pretty printer (nicejson.com)
8 points by crabl 4 months ago | hide | past | web | favorite | 5 comments



I usually use jq [0] for this:

    pbpaste | jq
[0]: https://stedolan.github.io/jq/


I used to do it a similar way, but often I ended up copying everything up to the final `}` character (or sometimes the input has single-quote characters rather than double-quotes), which causes the JSON to be invalid. NiceJSON takes the input (even if it's malformed), attempts to construct an abstract syntax tree using json-ast[0] and then serializes the output (which should be well-formed JSON).

[0]: https://www.npmjs.com/package/json-ast


I like the idea of pasting to see the formatted output. I needed something like that - so I built this for this purpose https://devstuffs.mustak.im/formatters/json-formatter-beauti...


Very nice!

I have a small bug report: When you first paste something NiceJSON doesn't understand (like an image) and then you paste some valid JSON, the page will become blank (no error messages). You have to refresh and re-paste to see the JSON you tried to paste.


Thanks for the feedback, I'll look into that later :)




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: