All your requirements except the indentation guide are possible out of the box with minted. If you need the indentation guide, you can manually add the vertical lines with escapeinside and tikzmark.
\documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark} \usepackage{minted} \newminted{JSON}{linenos,frame=single,framesep=10pt,style=autumn,escapeinside=??} \newcounter{JSONcode}\ExplSyntaxOn \int_new:N \g_kyu_JSONcode_int \AddToHook{env/JSONcode/before}{\stepcounter{JSONcode}\int_incr:N \g_kyu_JSONcode_int} \ExplSyntaxOn \clist_new:N \g_kyu_JSONmarks_clist \newcommand\NewDocumentCommand { \JSONmark }[1] { m } { \tikzmark{JSON-\theJSONcode\int_use:N \g_kyu_JSONcode_int-#1-begin} \clist_gput_right:Nn \g_kyu_JSONmarks_clist { #1 } } \newcommand\NewDocumentCommand { \finishJSONmark }[1] { m } { \tikzmark{JSON-\theJSONcode\int_use:N \g_kyu_JSONcode_int-#1-end} } \AddToHook{env/JSONcode/after} { \begin{tikzpicture}[remember~picture] \clist_map_function:NN \g_kyu_JSONmarks_clist \drawJSONmark\kyu_drawJSONmark:n \end{tikzpicture} \clist_gclear:N \g_kyu_JSONmarks_clist } \ExplSyntaxOff \cs_new_protected:Nn \kyu_drawJSONmark:n \newcommand{\drawJSONmark}[1] {% \draw[overlay,-,line width=0line~width=0.5pt,gray!50,shorten >=1emshorten~>=1em,shorten <=0shorten~<=0.3em] (picpic~cs\c_colon_str cs:JSON-\theJSONcode\int_use:N \g_kyu_JSONcode_int-#1-begin) -- (picpic~cs\c_colon_str cs:JSON-\theJSONcode\int_use:N \g_kyu_JSONcode_int-#1-end); } \ExplSyntaxOff \begin{document} \begin{JSONcode} ?\JSONmark{1}?"builders": [ ?\JSONmark{2}?{ "type": "test", "image": "ubuntu:latest", ?\JSONmark{3}?"changes": [ "EXPOSE 123 456", "CMD [\"/tmp/entrypoint.sh\"]" ?\finishJSONmark{3}?], "commit": true ?\finishJSONmark{2}?} ?\finishJSONmark{1}?] \end{JSONcode} \end{document} 