如何在jQuery中过滤JSON字符串?

时间:2014-08-11 11:35:53

标签: jquery json

假设我有一个JSON字符串,如下所示

var data =[{"Id":140,"Title":"My brochure","BrochurDate":"\/Date(1408473000000)\/","Date":"Wednesday, August 20, 2014","Categories":[{"Name":"Seniors","Id":127},{"Name":"Legislation","Id":129}]},{"Id":129,"Title":"Brochure 2","BrochurDate":"\/Date(1407436200000)\/","Date":"Friday, August 08, 2014","Categories":[{"Name":"Kids","Id":123},{"Name":"Insurance","Id":128}]},{"Id":128,"Title":"Brochure 1","BrochurDate":"\/Date(1402165800000)\/","Date":"Sunday, June 08, 2014","Categories":[]}]

如何通过1过滤上述JSON数据。类别 2. BrochurDate 在开始日期和结束日期之间?

假设我的设计如下图所示 enter image description here

以下是我尝试的 jsfiddle 2,它适用于标题,但无法按类别查找结果,请参阅注释行有

1 个答案:

答案 0 :(得分:0)

你可以这样使用

var json = $.parseJSON(data);
$.each( data,function(index,value)
{
  console.log(ind+' '+value);
});