3 ms·
I usually use jq [0] for this: pbpaste | jq [0]: https://stedolan.github.io/jq/ https://stedolan.github.io/jq/
by ezekg 8y ago
I usually use jq [0] for this:
pbpaste | jq
[0]: https://stedolan.github.io/jq/ https://stedolan.github.io/jq/
- crabl 8y agoI 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 https://www.npmjs.com/package/json-ast