Filter JSON data with some column and again create the data with json format

Posted by Vishalneeraj-24503 under JavaScript on 1/4/2018 | Points: 10 | Views : 115 | Status : [Member] [MVP] | Replies : 0
Hi All,

I have below json data.
I want to filter using url and yyyy_mm column and create the new data in json format.

i have 2 requirements here:-
1). filter using url column, suppose if i pass url as http://google.com then it should return me all data which contains google.com.

2). filter using url and yyyy_mm column. So in this case whatever matching rows should be returned.
Please note that :- it should return me json object.


I tried using $.grep but did not achieve anything. In some cases $.grep is not working.
I am using Node.JS and creating html tags dynamically and showing data.


var tempData =[{"url":"http://google.com","yyyy_mm":"2017-12","skills":"C#","count":3},                    {"url":"http://google.com","yyyy_mm":"2017-11","skills":"F#","count":4}
{"url":"http://google.com","yyyy_mm":"2017-10","skills":"asp.net","count":4}, {"url":"yahoo.com","yyyy_mm":"2017-12","skills":"vb.net","count":10},
{"url":"yahoo.com","yyyy_mm":"2017-11","skills":"vb.net","count":5},
{"url":"yahoo.com","yyyy_mm":"2017-11","skills":"vb.net","count":6},
{"url":"yahoo.com","yyyy_mm":"2017-11","skills":"vb.net","count":10},
{"url":"yahoo.com","yyyy_mm":"2017-10","skills":"vb.net","count":11},
{"url":"yahoo.com","yyyy_mm":"2017-10","skills":"json","count":100}]


Thanks in Advance!!!!!

What I have tried:

I tried using $.grep but did not achieve anything. In some cases $.grep is not working.
I am using Node.JS and creating html tags dynamically and showing data.




Responses

(No response found.)

Login to post response