Pygments is a syntax highlighting tool that supports a wide range of languages and data formats. However, pygments does not provide a JSON highlighter. JSON can, of course, be parsed by the Javascript lexer, but the resulting output looks very plain and provides limited value over non-highlighted text.
pygments-json attempts to provide more interesting syntax highlighting which correctly distinguishes between attribute names and values. I'm new to pygments and to python packaging, so please don't hesitate to tell me if I've done something wrong or if the JSON parsing doesn't quite work for you.
The pygments-json JSONLexer has been submitted to the Pygments project for inclusion in an upcoming release.
$ pip install pygments-json
Pygment json highlighting is available without any further customization from code as well as from the pygementize command:
$ pygmentize your-file.json
... beautifully formatted json will flow here
- Norman Richards
- orb@nostacktrace.com