I have a json object that I load from wordpress using the JSON API plugin. When I load a json object and try to deduce it from it, it seems that it considers each individual symbol as its own object, so the loop returns me a couple of thousand objects with an element in it, which is the only symbol. This is my first time using json so idk if I don't see a step here. this is the code i'm still using.
function getProjInfo(theId){ $.ajax({// calling the ajax object of jquery type: "GET",// we are going to be getting info from this data source url: 'http://testing.charter21.com/api/get_post/?post_id='+ theId,//the datasource dataType: "application/json", success: function(data){ parseJson(data); }, // what happens when it is successful at loading the XML error: function(){ alert("error"); } }); }//end of the function function parseJson(inData){ postInfo = inData; $.each(postInfo, function(index, value){ console.log(this); }); }
json looks like this:
{
"status": "ok",
"count": 10,
"count_total": 19,
"pages": 2,
"posts": [
{
"id": 175,
"type": "post",
"slug": "home-page-slider",
"url": "http:\/\/testing.charter21.com\/uncategorized\/home-page-slider\/",
"status": "publish",
"title": "Home Page slider",
"title_plain": "Home Page slider",
"content": "<p>The cImages in here are the images that are in the slider on the home page this content in this box will not show up. Its only here as a guide.<\/p>\n",
"excerpt": "The cImages in here are the images that are in the slider on the home page this content in this box will not show up. Its only here as a guide.",
"date": "2011-01-25 10:40:25",
"modified": "2011-01-25 10:40:25",
"categories": [],
"tags": [],
"author": {
"id": 1,
"slug": "admin",
"name": "admin",
"first_name": "",
"last_name": "",
"nickname": "admin",
"url": "",
"description": ""
},
"comments": [],
"attachments": [],
"comment_count": 0,
"comment_status": "open"
}
so instead of giving me βstatusβ as the key and βokβ as the value, I get βsβ as an object with index 0, which has the value βsβ for every single character in the json object. Any help on this would be appreciated.