I am writing a JSON response from a perl/cgi program. The header\'s content type needs to be \"application/json\". But it doesn\'t seems to be recognized as response is thro
Even if you specify the type "application/json" you still need to parse the text. jQuery do this for you, using the $.getJSON function,ie:
$.getJSON("http://someurl.com/blabla.json",{some: "info"},function(json){
alert(json["aKey"]["anotherOne"]);
});
(here the specs).
But maybe you are already aware of this, so the problem resides somewhere else: can you please tell us a sample of your json response, because maybe the problem is that is not valid. It's not really clear to me why you say that "doesnt seems to be recognised": when I write json services the first test I do is to call them on the browser and maybe fire up firebug and try to parse it (so yes the response it's a text response, but javascript it's still quite happy to parse it and return a json object).