Welcome Guest, Not a member yet? Register   Sign In
How to extract data from JSON string by using JQuery
#3

[eluser]Victor Michnowicz[/eluser]
This should get you started on the right track:

Code:
var obj = jQuery.parseJSON('{"json":[{"ThreadID":"213","ThreadTitle":"Christian Heilmann\'s talk for the why of HTML5 for games development","ThreadAuthorFirstName":"Suresh kumar"},{"ThreadID":"208","ThreadTitle":"The PHP Switch Statement","ThreadAuthorFirstName":"Suresh kumar"},{"ThreadID":"212","ThreadTitle":"DaVinci prototype on Xbox Kinect","ThreadAuthorFirstName":"Suresh kumar"}]}');
            
for (var i in obj.json) {
    alert(obj.json[i].ThreadID);
}

The jQuery function .getJSON() could come in handy depending on how you are accessing your JSON.

Make sure you escape your apostrophes too.


Messages In This Thread
How to extract data from JSON string by using JQuery - by El Forum - 01-17-2011, 07:31 AM
How to extract data from JSON string by using JQuery - by El Forum - 01-17-2011, 08:35 AM
How to extract data from JSON string by using JQuery - by El Forum - 01-17-2011, 08:58 AM
How to extract data from JSON string by using JQuery - by El Forum - 01-17-2011, 10:54 AM
How to extract data from JSON string by using JQuery - by El Forum - 01-17-2011, 11:03 AM
How to extract data from JSON string by using JQuery - by El Forum - 01-20-2011, 12:53 AM
How to extract data from JSON string by using JQuery - by El Forum - 01-20-2011, 07:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB