javascript - How to properly parse a multidimensional JSON array -


jsfiddle providing exact duplication of errors: jsfiddle

i trying "step" through multidimensional array. each time try load $.parsejson() error thrown. have spent hours dr. google looking answers or hints. so, if has been answered, please gentle.

my json array trying step through created json_encode() of data posted ajax function.

{     "propertytype": "{"     propertytype1 ":"     apartment style flat ","     propertytype2 ":"     loft style "}",     "houseage": "",     "living_area": "" } 

ajax data being sent php before being posted: console.log(vals.advanced) produces

object {     propertytype: "{"     propertytype1 ":"     apartment style flat ","     propertytype2 ":"     loft style "}",     houseage: "",     living_area: "" } 

edit: data arrays created following code:

var checkboxes = [     'propertytype' ];  // gather checked check boxes , store in json array format submission $.each(     checkboxes,     function (i, e) {         if(i==0) i=1;          var found = false;         $("input[name=" + e + "]:checked").each(             function () {                 id = this.name;                 arrcb[id + i++] = (this.value);                 found = true;             }         );         if (found) {             advanced[id] = json.stringify(arrcb);             = 1;             arrcb = {}; // 0 out holders         }     } );  advanced['houseage'] = $('#houseage').val(); advanced['living_area'] = $('#living_area').val(); //advanced['lotsize'] = '';  // store data in array post server vals = {     advanced: advanced };  $.post(    "<?php echo $this->url->get('/ajax/session/update');?>",    {values: vals} ); 

the session file data created by:

$this->session->set('advancedsearchcriteria', json_encode($values['advanced'])); 

so while understand comments "arrays" shown above "not json" can ask, "how that?" wrong code above?

thank thoughts.

answer in comments below others stated not valid json. shown in examples above json created jquery regardless if valid or not.

with comments barmar found stringify command used above not in proper place. updated code follows , works.

if (found) {    advanced[id] = arrcb; //json.stringify(arrcb);    = 1;    arrcb = {}; // 0 out holders } 

and in vals array:

vals = {    advanced: json.stringify(advanced) }; 

hopefully else.