Javascript examples for JSon:JSon Object
Match values of Array with JSON
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w ww .j a va 2 s. c o m*/ var arr = Arr = ["a", "b", "c"]; var json = '{"my":{"cat":[{"val":"d"},{"val": "c"}]}}' var obj = JSON.parse(json); var cate = obj.my.cat for (var i = 0; i < Arr.length; i++) { for (var j = 0; j < cate.length; j++) { if (Arr[i] == cate[j].val) { console.log(cate[j].val) } } } } </script> </head> <body> </body> </html>