Scale Listing inside figure

I'm writing a seminar paper about a Client-Server Application and I try to include the code I implemented. I do so with

\begin{figure} [H]

\begin{lstlisting}

\end{lstlisting}
\caption{Die Datei package.json}
\label{packagejson}
\end{figure}

, so that it is mentioned in listoffigures. The problem I have now is that the listing inside the figure has to be on one side an can't be splitted. I also cannot scale it to a certain size ( I tried using minipage ...) . Do I have to make two Listings if it does not fit on one page?