# Code in \lstlisting breaks document (compile error)

I want to show a JSON object in my document. If I do the following, it works:

\begin{lstlisting}
{
"id": "5",
}
\end{lstlisting}


But if I extend the code to the following, then there are only errors when compiling the document:

\begin{lstlisting}
{
"id": "5",
"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?

-
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Marco Daniel Mar 3 '13 at 15:13
I would guess you have a language shorthand (babel?) that defines " to do something, you can locally turn shorthands off, which might help. –  David Carlisle Mar 3 '13 at 15:13
@DavidCarlisle: I thought this is related to france. Benny lives in Germany ;-) –  Marco Daniel Mar 3 '13 at 15:17
Thank you David! Yes, I use babel. The problem was that the name of my chapter was "\chapter{Implementation of "Jiga"'}". I changed it to "\chapter{Implementation of Jiga}" which removed the error. –  Benny Neugebauer Mar 3 '13 at 15:19
There is no relation to babel. :-) –  Marco Daniel Mar 3 '13 at 15:22

I would guess you have a language shorthand (babel?) that defines " to do something, you can locally turn shorthands off, which might help