Take the 2-minute tour ×

I'm calling a REST webservice and getting JSON format as a result. I'm calling rest service from another domain than mine. How can I parse this?

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted
<script type="text/javascript" src="http://www.json.org/json2.js"></script>
var myObject = JSON.parse(myJSONtext);

or use jQuery

$.getJSON('http://twitter.com/users/usejquery.json?callback=?', function(json) {

if you need only parsing jQuery also can do this:

alert( obj.name === "John" );
share|improve this answer
add comment

To answer the question you asked: There is a long list of parsers, including several for JavaScript, at the bottom of http://json.org/

If your question is actually: "How can I read JSON data from another domain with client side JavaScript in the browser?", then you can either fetch it using a proxy on the same domain as the page, or you can provide the data using JSON-P instead.

share|improve this answer
upvote for answering both questions. –  Jonathan Fingland Sep 30 '10 at 13:30
add comment

Are you getting the json result? Most implementations have protection agains cross site scripting and will only allow a request back to the original host of a page.

Could you please post some example code for your current implementation.

share|improve this answer
add comment

Your Answer


