In fact, it doesn't perform full JSON parsing. It consider spaces, quoted strings, brackets (including brackets balance), colons (in context), commas... In addition, it emphasizes quoted strings right before colons and mark them as keys.
Thanks to this, it can treat semi-JSON strings like this:
12:00:00 INFO Request: {"msg": "hellow"}, Response: {"ok": true}
You can find code of this demo in demo brunch.
You can also play with library online. However, this online sandbox doesn't allow to display colored text. Instead of painted text it you will show you control sequences (ANSI escape codes) as is.
fmt.Println(paintjson.String(`{"x":12}`))
go get github.com/michurin/jsonpainter
- The library gets to have too much heuristics. It has to be rethinking in terms of full-fledged parser.
- Streaming: obtain
io.Reader - CLI tool
