jquery - Knockout.js mapping plugin, accessing json nested multiple levels -


is possible knockout.js mapping plugin access json nested data or can find first level data?

if mapping plugin cannot access nested data there solution?

in example, "number" mapping correctly "duedate" not map.

// json nested data {    "level1":[       {          "level2":{             "duedate":"\/date(1362124800000)\/",             },          "number":5499       }, }  // here's data model - need map "duedate" observable. var viewmodel; $.getjson('/myjsondata', function (data) {     viewmodel = ko.mapping.fromjs(data);     ko.applybindings(viewmodel); }); 

are sure can't access duedate ? because in fiddle can.

// json nested data var data = {     "level1": [{         "level2": {             "duedate": "\/date(1362124800000)\/",         },             "number": 5499     }] }; var viewmodel = ko.mapping.fromjs(data); ko.applybindings(viewmodel);  var duedate = viewmodel.level1()[0].level2.duedate;  alert(typeof duedate); 

Comments

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -