Question

My REST Web Service returns a JSON response using the following code:

header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
header("Content-Type: application/json");
echo json_encode($languages,128);

However, when I test the service on my browser - it renders the JSON as HTML. If I inspect the source, I can see HTML tags and everything. What's causing this and how do I fix this?

Raw source code

Response Headers

Thanks.

P.S.: I'm using the Slim Framework, if that makes a difference.

Was it helpful?

Solution

You probably have a browser extension installed that presents JSON as a nicely formatted, human readable HTML document.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top