javascript - How to combine two json properties into one array -
I have a Jason data:
var data = [{"" RM_name ") : "No Phone No", "RCPhone": "No Phone", "Stateman": "Magnificent": "Cloud Striif", "Division": "Avalanche", "RMPhone": "No Phone", "RCName" "No RC", "RCPhone": "No Phone", "RC", "NBC", "Ringtones", "Cliff Eastwood", "Division": "Hollywood", "RMPhone": "No Phone", "RCName" , "Statewoman": "Barry Wallen"}, "Barrett Wallace", "Division": "Snow "RM": "RM", "RC", "RC", "RC", "" Barry Allen "," RCPhone ":" No Phone "," North Korea "," North Coral "}," RM_Name ":" TIFA Lockhardt "", "Division": "Avalanche", "RMPhone": "No Phone", "RCName": "Eris Gainsborough", "RCPhone": "No Phone", "Statewoman": "Sector 7"}];
Now I want to create a new array that should include the RM_Name and RC_N names so that the output should be like this:
[cloud conflict, Int Eastwood, Barrett Wallace, Barry Allen, Taifa Lockhart, Eris Gensbro]
I can do this? I $ I tried to use merge ()
but I think the output is wrong. Any help is greatly appreciated.
Use jQuery to iterate JSON. Try it out:
var dataArray = []; $ .each (data, function (i, v) {dataArray.push (v.RM_Name); if (v.RC_Name! = "No RC") data; Push (v.RC_Name);}); Console.log (dataArray);
Comments
Post a Comment