Better JSON highlighting for pygments
Latest commit c59887e Mar 11, 2012 @orb Merge pull request #1 from gandaro/json-mimetype
add JSON mime type
Failed to load latest commit information.
pygson add JSON mime type Mar 6, 2012
.gitignore add usage Aug 28, 2011
README.rst more cleanup Sep 30, 2011 implement json lexer Aug 28, 2011



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