How to add background color to code to code box

How do I add a background color to the following?

\begin{lstlisting}

{
"client_id": "string",
"api_key": "string",
}
\end{lstlisting}

• Welcome to TSE. Please provide a MWE. Jan 19 '18 at 17:25

You can use \lstset{...} to change settings on your listing; in this case, you want to change the backgroundcolor setting. The xcolor package provides colors you can use.

\documentclass{article}

\usepackage{xcolor}

\lstset{backgroundcolor=\color{blue}}

\begin{document}
\begin{lstlisting}

{
"client_id": "string",
"api_key": "string",
}
\end{lstlisting}
\begin{document}


Additionally, you can define your own colors using the \definecolor macro. For example, to use hex color codes, you could use \definecolors{lightblue}{HTML}{0088FF}, and then reference the color lightblue in your background color setting.

For more information on colors, the LaTeX Wikibook has a more in-depth description.