Get Started With JSON

Get Started With JSON | Webmonkey |

var movielisttext = "{"movielist": ["Friday the 13th", "Friday the 13th Part 2", "Friday the 13th Part III", "Friday the 13th: The Final Chapter", "Friday the 13th: A New Beginning"]}";

var jsonobj = eval("(" + movielisttext + ")");
var moviearray = jsonobj["movielist"];
var firstmovie = moviearray[0];
var thirdmovie = jsonobj["movielist"][2];

var jsonobj = eval("(" + reviewtext + ")");
var reviewername = jsonobj["reviewer"];

var reviewername = jsonobj.reviewer;

var numberstars = jsonobj.stars;

var reviewerthoughts = jsonobj.text;

This entry was posted in Code Snippets. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s