It seems you have json inside the <code> tag.
So first (after you get the inner html of the <code> tag) get rid of the comments (‘<!--‘, ‘-->‘) and then use function json_decode()
solved How to parse information within HTML tag using php [duplicate]