Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging JSON using Chrome's Dev Tools

How do I access the results array from the following page using Google Chrome's console?

twitter.com/search.json?q=stackexchange

I keep getting this error:

ReferenceError: results is not defined

enter image description here

enter image description here

like image 482
Anthony Avatar asked Apr 30 '13 11:04

Anthony


People also ask

How do I debug JSON in Chrome?

You can type: console. debug( , then CTRL+Space, you will see all accessible objects and methods. +1 cool. I really enjoyed accessing these variables from the console, wish I could access "results" because its so much easier for me to understand JSON.

How do I debug JSON?

To enable the display of JSON debug information, in the Forms Builder Settings workspace, select Debug - Show Generated JSON Model, select the Value check box, and click Save Settings.


1 Answers

If what you really want is to browse this result set in a convinient way, just install one of JSON viewers for Chrome (preferably JSONView).

If you don't want to install any plugins, just run this:

JSON.parse($('.webkit-line-content').innerHTML);

in the console on page:

view-source:https://search.twitter.com/search.json?q=stackexchange
like image 154
Konrad Dzwinel Avatar answered Oct 01 '22 17:10

Konrad Dzwinel