Is it possible to decorate JSON inside a document?

I was wondering if anyone knew how to decorate or format JSON inside a latex document. I use Lyx as a front-end to write a latex file. Are there any add-ons that people use? I tried to search, but could not get something important.

+6
json code-formatting beautifier latex lyx
source share
2 answers

I embed the code in the Lix mainly as lists of programs imported from external text files. There are many options that you can apply to the list of programs, from line numbers to word wrappers and many others.

-one
source share

I am using minted .

You must install and configure it first (remember to add the pygmentize.cmd file on Windows 7). Then you should add \usepackage{minted} to LaTeX Preambel and finally paste the following code into the TeX Code field (for JSON you can use the js code type):

 \begin{listing} \begin{minted}[frame=single, framesep=3mm, linenos=true, xleftmargin=21pt, tabsize=4]{js} { "firstName": "John" "lastName" : "Smith", "age" : 25 } \end{minted} \caption{JSON example} \label{json-example} \end{listing} 

This is not an ideal solution, but it works and produces a really good list: minted json example

+22
source share

All Articles