I am using linq.js to filter a JSON object filteredRegionList
. I have a property in my object named dimRegionID
and an array regionList
containing regionID's. Now I want to filter filteredRegionList
fordimRegionID
present in
regionList
. I am using the below mentioned code for the same.
JSON.parse(Enumerable.From(filteredRegionList)
.Where(function (x) { return Enumerable.From(filteredObj).Contains(x.dimRegionID) })
.Select(function (x) { return x; }).ToJSON());
This is not working for me. Could any one please tell me what mistake I am doing in the where clause.
I think your filtering by the wrong array, you specified in your question that your trying to filter by "regionList", but you actually filtering by "filteredObj":
JSON.parse(Enumerable.From(filteredRegionList)
.Where(function (x) { return Enumerable.From(regionList).Contains(x.dimRegionID) })
.ToJSON());