I have a json object that I'm loading from wordpress using the JSON API plugin. When I load the json object and try to log out the parts of it, it seems like it treats every single character as its own object so the loop returns me a couple thousand objects all with item in it which is a single character. This is my first time using json so idk if i'm missing a step here. this is the code I'm using so far.
the json looks like this:<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
so basically instead of giving me "status" as an key and "ok" as a value, i get "s" as an object with an index 0 that has a value of "s" for every single character in the json object. Any help on this matter would be appreciated.
Code:
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);
});
}
the json looks like this:<br>
Code:
{
Code:
"status": "ok",
Code:
"count": 10,
Code:
"count_total": 19,
Code:
"pages": 2,
Code:
"posts": [
Code:
{
Code:
"id": 175,
Code:
"type": "post",
Code:
"slug": "home-page-slider",
Code:
"url": "http:\/\/testing.charter21.com\/uncategorized\/home-page-slider\/",
Code:
"status": "publish",
Code:
"title": "Home Page slider",
Code:
"title_plain": "Home Page slider",
Code:
"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",
Code:
"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.",
Code:
"date": "2011-01-25 10:40:25",
Code:
"modified": "2011-01-25 10:40:25",
Code:
"categories": [],
Code:
"tags": [],
Code:
"author": {
Code:
"id": 1,
Code:
"slug": "admin",
Code:
"name": "admin",
Code:
"first_name": "",
Code:
"last_name": "",
Code:
"nickname": "admin",
Code:
"url": "",
Code:
"description": ""
Code:
},
Code:
"comments": [],
Code:
"attachments": [],
Code:
"comment_count": 0,
Code:
"comment_status": "open"
Code:
}
so basically instead of giving me "status" as an key and "ok" as a value, i get "s" as an object with an index 0 that has a value of "s" for every single character in the json object. Any help on this matter would be appreciated.