I am developing an applicaiton where I am getting the following JSON data from the server:
var requests =
{
"id":"12","start":"2016-05-20 07:00:00",
"end":"2016-05-20
10:00:00",
"price":"0",
"paid":"no",
"accepted":"yes",
"reviewed_by_provider":"no",
"reviewed_by_client":"no",
"created_by_user_id":"35",
"provided_to_user_id":"36"
},
{"id":"13",
"start":"2016-05-20 07:30:00",
"end":"2016-05-20 11:00:00",
"price":"0",
"paid":"no",
"accepted":"yes",
"reviewed_by_provider":"no",
"reviewed_by_client":"no",
"created_by_user_id":"35",
"provided_to_user_id":"36"
},
{
"id":"14",
"start":"2016-05-20 07:30:00",
"end":"2016-05-20 10:00:00",
"price":"0",
"paid":"no",
"accepted":"no",
"reviewed_by_provider":"no",
"reviewed_by_client":"no",
"created_by_user_id":"35",
"provided_to_user_id":"36"
}
In JavaScript by running a for each loop, I want to eliminate the sets where "accepted":"no"
and then from the remaining sets, I want to delete all the other parameters except id
, end
and start
.
How do I do this in JavaScript? Note that I am developing this application in angularJS.
Any ideas?