Google Chrome display JSON AJAX response as tree and not as a plain text
I cannot find an answer to this one:
My AJAX calls return JSON data. In Google Chrome Developer Tools > Resources > XHR when I click on the resource on the left and then on the Content tab I see the JSON string as a string and not as a tree as Firebug and Firebug Lite do.
How do I force Chrome to display it as a tree. Is there a Content-type that my PHP file must have???
Solution 1:
To see a tree view in recent versions of Chrome:
Navigate to Developer Tools > Network > the given response > Preview
Solution 2:
Google Chrome now supports this (Developer Tools > Network > [XHR item in list] Preview
).
In addition, you can use a third party tool to format the json content. Here's one that presents a tree view, and here's another that merely formats the text (and does validation).
Solution 3:
The correct content-type for JSON data is application/json
. I assume that is what you are missing.