JSON数组对象某个属性值查找

1、引用国外开源Linq写法的js框架

地址:https://archive.codeplex.com/?p=jslinq

https://www.nuget.org/packages/jslinq

说明实例:https://www.cnblogs.com/landeanfen/p/4672542.html

<script src="js/linq.js"></script>

<script type="text/javascript" >
            
            var packJson = [
                {"name":"zhang", "password":"123"},
                {"name":"li", "password":"456"}
            ];
            var name="li";
            var de=Enumerable.From(packJson).Where("x=>x.name=='"+name+"'").ToArray();
            if(de!=null && de[0]!=null){
                console.log(de[0].password);    
            }
</script>

 

posted @ 2018-06-15 10:43  江宁织造  阅读(11859)  评论(0编辑  收藏  举报