Click here to Skip to main content
15,893,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a json like the following:

{
"SeriesId": "",
"ContentId" : "10001",
"PolicyGroupId" : "1234",
"ChannelId": "231",
"Title" : "Game of Thrones",
"Number" : "1",
"IsAuthorized": "true|false",
"Description" : "Season 1 of the epic, award winning HBO series \"Game of Thrones\"",
"DurationSeconds": "1800",
"LinearStartDateTime": "2013-03-12T00:35:00Z",
"Images" : {
"Type": "Thumbnail",
"Url": "http://www.elysium-uk.com/site/wp-content/uploads/2012/04/Game-of-Thrones-Season-2-Teaser.jpg"
}

I want to remove some of nodes like ChannelId, Number etc. What is the way to remove json nodes?

Please guide.

Thanks
Posted

1 solution

Copied from stackoverflow

function findAndRemove(array, property, value) {
   $.each(array, function(index, result) {
      if(result[property] == value) {
          //Remove from array
          array.splice(index, 1);
      }    
   });
}

//Checks countries.result for an object with a property of 'id' whose value is 'AF'
//Then removes it ;p
findAndRemove(countries.results, 'id', 'AF');


Link [^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900