TransWikia.com

LaTeX listings package JSON formatting

TeX - LaTeX Asked on September 30, 2020

I am using package listings for JSON data. I am following this example How to improve listings display of JSON files from this stackexchange answer. It generates the following output:
enter image description here
I added caption to the listing using:

begin{lstlisting}[language=json,firstnumber=1,caption={My Caption},captionpos=b]

I want to make the listing look like this:

enter image description here

  • The line numbers are in grey color and smaller font
  • The keys are in bold font and black color, the quotes of the keys are not bold
  • The values colors are based on their data type: string→green (with quotes green too), number→red, boolean→cyan, float→blue etc.

I can change the color of brackets, colon, and comma, and the font is fine too, but i am struggling with the keys and values formatting and line numbers color & size. Any help will be highly appreciated.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP