I want to show a JSON object in my document. If I do the following, it works:
\begin{lstlisting}
{
"id": "5",
"key": "discardedCard"
}
\end{lstlisting}
But if I extend the code to the following, then there are only errors when compiling the document:
\begin{lstlisting}
{
"id": "5",
"key": "discardedCard",
"value": {
"suit": "DIAMONDS",
"rank": "QUEEN"
}
}
\end{lstlisting}
Error log:
! Incomplete \iffalse; all text was ignored after line 19.
<inserted text>
\fi
l.19 "
suit": "DIAMONDS",
A forbidden control sequence occurred in skipped text.
This kind of error happens when you say `\if...' and forget
the matching `\fi'. I've inserted a `\fi'; this might work.
! Incomplete \iffalse; all text was ignored after line 19.
I'd like to provide a MWE but if I run the code in a MWE then it works. So it looks like there are other parts in my bachelor thesis which break the document.
Is there a way to output code in a listing in a secure way or maybe escaped?
\documentclass{...}
and ending with\end{document}
."
to do something, you can locally turn shorthands off, which might help.