ajax获取到json数据后,如何筛选json满足特定值的对象?? 财富值92

2016-10-18 20:10发布

[     {         "province":"广东",         "item":[             {                 "ID":"1",                 "province_id":"7",                 "title":"广东小吃 好吃真好吃",                 "imgUrl":"http://xxxx/images/item/7_001.jpg",                 "link":"https://xxxxxxxxx"             },             {                 "ID":"2",                 "province_id":"7",                 "title":"广东炒饭 香喷喷爱上",                 "imgUrl":"http://xxxx/images/item/7_001.jpg",                 "link":"https://xxxxxxxxx"             }         ]     },     {         "province":"江西",         "item":[             {                 "ID":"1",                 "province_id":"8",                 "title":"江西小吃 好吃不上火",                 "imgUrl":"http://xxxx/images/item/7_001.jpg",                 "link":"https://xxxxxxxxx"             },             {                 "ID":"2",                 "province_id":"8",                 "title":"江西炒饭 香喷喷",                 "imgUrl":"http://xxxx/images/item/7_001.jpg",                 "link":"https://xxxxxxxxx"             }         ]     },     {         "province":"广西",         "item":[             {                 "ID":"1",                 "province_id":"9",                 "title":"优质酱卤牛肉",                 "imgUrl":"http://xxxx/images/item/7_001.jpg",                 "link":"https://xxxxxxxxx"             },             {                 "ID":"2",                 "province_id":"9",                 "title":"农家自制豆制品豆干豆腐",                 "imgUrl":"http://xxxx/images/item/7_001.jpg",                 "link":"https://xxxxxxxxx"             }         ]     } ]

如上面是ajax获取到的json数据,我想要找到title="炒饭"(模糊搜索)所在的对象(符合条件的对象可能不止一个,只要符合都找出来),结果为:

{     "ID":"2",     "province_id":"7",     "title":"广东炒饭 香喷喷爱上",     "imgUrl":"http://xxxx/images/item/7_001.jpg",     "link":"https://xxxxxxxxx" }, {     "ID":"2",     "province_id":"8",     "title":"江西炒饭 香喷喷",     "imgUrl":"http://xxxx/images/item/7_001.jpg",     "link":"https://xxxxxxxxx" }

js白痴一枚,求大神指导,我能无耻的求一份demo吗?再不济也请告诉我一下如何实现的思路好么?还有两天,做不出来就完蛋了,跪求!

友情提示: 问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
0条回答

一周热门 更多>