Saqib Ali Saqib Ali - 4 months ago 7x
JSON Question

How to examine the JSON response from a REST endpoint from Chrome's dev console?

I have a REST endpoint as follows:


When you hit this endpoint it returns some JSON data.

I want to hit this endpoint from Chrome's developer console. This is what I'm typing in there:

$http = angular.element(document.body).injector().get('$http');

When, I do this, I can see from the endpoint's perspective that it was called. That's great. However, the response I see in the console is the image below. It's just a promise. How can I see the actual JSON structure that is returned??

enter image description here


If you need to actually see the data, look at the network tab. But it will be more useful for you to set up a callback so you can correctly use the data that is returned.


Possibly console.log(JSON.stringify(data)) will make it more readable.