javascript - JSON count an Array elements and wrap in -


Well I have searched for JSON today, but I have a problem using it properly, I'm really The solution can not be found ...

Actually, I just want to count the elements of my array (count all the DM), and wrap on a specific element (eg DM1). / P>

This is my code so that you can understand:

What Pointy said That your code is modified:

  Object.size = function (obj) {var size = 0, key; (Key in obj) {if (obj.hasOwnProperty (key)) size ++; } The size of the return; }; Var dMContent = {"dM1": [{"name": "EEEEEEE", "link": "http://test.com"}, {"name": "FFFFFFF", "link": "http: "{{Name}:" EEEEEE "," link ":" {{name}: "GGGGG", "link": "http://test.com"}], "DM2" : "Http: //test.com"}, {"name": "FFFFFFF", "link": "http://test.com"}], "DM3": [{"Name": "EEEEEE "" Link ":" http://test.com "}]}; Var STORAGE = JSON.stringify (DMContant); Var persessed = JSON PERS (STORAGE); // What I want to do is calculate the amount of // dm console.log (object size); // displays 3 / content (parsed in var i) {console.log ('in data' + i); (Var j = 0; j & lt; parsed [i] .length; j ++) {console.log (parsed [i] [j] .name + '' + pars [i] [j]. Link); }}    

Comments