When looking at the results of a url in my browser and I would like to open up the Developer Tools javascript console and use javascript commands to analyze the results of the page. Here's an example page:
http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=ju6z9mjyajq2djue3gbvv26t&q=deep&page_limit=2&page=1
Note - I'm changing the url for this - rotten tomatoes' URL isn't public and my key expired. This example from jsontest works with the accepted answer.
http://echo.jsontest.com/movies/ET
Is there a way to click on this, launch the firebug console (or something similar in another browser) and parse this json string so I could use common javascript to inspect the json object.
EDIT
JQuery is not available...
Right click on JSON file, select open, navigate to program you want open with(notepad). Consecutive opens automatically use notepad.
The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned.
In Chrome, I opened the link above and went to Chrome's Developer Tools (F12) and entered the following command in the console...
JSON.parse(document.body.textContent)
It returns a the object representation quite nicely. From there is an easy matter to manipulate and play with the object in Javascript. For instance...
JSON.parse(document.body.textContent).movies.length
...returns 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With