How can we get the variable value from script tag of HTML response using javascirpt

I would like to get the ‘g_listData’ from the following HTML response using Javascript.

    <html>
        <body>
        <script type="text/javascript">

        var g_deferData= "testdata";

        var g_listData = {"ListData":{ "Row" : [{
        	"ID": "85018",
        	"FileLeafRef": "test only"
        	}
        	,{
        	"ID": "85091",
        	"FileLeafRef": "completed"
        	}]
          }}
        </script>
        </body>
     </html>

Hey @aravi.a620 :wave:

What have you tried so far?

There have been many posts on the community site around using cheerio to extract different pieces of data from those kinds of responses.

Hi @dannydainton,

I found a simple solution, I just used the split() method inside content. I never used cheerio earlier but it looks very interesting, maybe I will use it later especially to parse my XML response. Thanks