Text color in Verbatim environment in LaTeX

latex

How do I change the color of some parts of text inside the verbatim environment. I have something like this:

\tiny\begin{verbatim}
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Expires: Mon, 1 Aug 2011 09:00:00 GMT
Connection: close
Access-Control-Max-Age: 0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Headers: Content-Type
Content-type: application/json
[{"error":{"type":1,"address":"/","description":"unauthorized user"}}] <--- This text needs to be red
\end{verbatim}
\normalsize

I need to make this line red:

[{"error":{"type":1,"address":"/","description":"unauthorized user"}}]

Best Answer

fancyvrb seems well-suited for this task:

enter image description here

\documentclass{article}
\usepackage{fancyvrb,xcolor}

\begin{document}

This is some preceding text.

\begin{Verbatim}[fontsize=\small,commandchars=\\\(\)]
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Expires: Mon, 1 Aug 2011 09:00:00 GMT
Connection: close
Access-Control-Max-Age: 0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Headers: Content-Type
Content-type: application/json
(\color(red)"error":{"type":1,"address":"/","description":"unauthorized user"}}])
\end{Verbatim}

This is some following text.
\end{document}

Since no \, ( or ) occurred within the verbatim requirement, it was used as control sequence and parameter text delimiters.