Just wondering if some one can help me with some a issue I am having parsing json data. I will start with a spinet of the JSON i won’t include all of it (JSON is also valid) :
"X_bizCardServiceLinks": [
{
"name": "blogs",
"js_eval": "generalrs.label_personcard_blogslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/blogs\/roller-ui\/blog\/dbb8fac0-42e4-102e-9409-b38b9530f95e"
},
{
"name": "quickr",
"js_eval": "generalrs.label_personcard_quickrlink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/quickr\/allfiles\/people\/Jonathan.Popoola@trinitymirror.com"
},
{
"name": "profiles",
"js_eval": "generalrs.label_personcard_profilelink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/profiles\/html\/simpleSearch.do?searchFor=dbb8fac0-42e4-102e-9409-b38b9530f95e&searchBy=userid"
},
{
"name": "activities",
"js_eval": "generalrs.label_personcard_activitieslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/activities\/service\/html\/mainpage#dashboard%2Cmyactivities%2Cuserid%3Ddbb8fac0-42e4-102e-9409-b38b9530f95e%2Cname%3DJonathan Popoola"
},
{
"name": "dogear",
"js_eval": "generalrs.label_personcard_dogearlink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/dogear\/html?userid=dbb8fac0-42e4-102e-9409-b38b9530f95e"
},
{
"name": "communities",
"js_eval": "generalrs.label_personcard_communitieslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/communities\/service\/html\/allcommunities?userid=dbb8fac0-42e4-102e-9409-b38b9530f95e"
},
{
"name": "wikis",
"js_eval": "generalrs.label.personcard.wikislink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/wikis\/home\/search?uid=dbb8fac0-42e4-102e-9409-b38b9530f95e&name=Jonathan Popoola"
},
{
"name": "files",
"js_eval": "generalrs.label_personcard_fileslink",
"href": "https:\/\/dc3-epag-03.tm-gnet.com\/files\/app\/person\/dbb8fac0-42e4-102e-9409-b38b9530f95e"
}
],
What I need to do is access each child element of the “X_bizCardServiceLinks” and store the name and href to a variable – I am able to return all of the individual children but not target each child separately – I am using the following code :
$.each(response.X_bizCardServiceLinks, function(){
$.each(this, function(n, v){
var random = n;
var anotherRandom = v;
console.log(v);
//$("#linkTable tr").append("<td><a href=\""+ this.href +"\">"+ this.name +"</a>");
});
});
Response is the JSON but stored, any help would be greatly appreciated thanks in advance,
You are trying much too hard
http://jsfiddle.net/F8XPM/