I need to assign dynamic values to JavaScript dictionary to be used to echarts but when assigning the dynamic values to dictionary it is showing the different behavior as compare to assigning the static values.
when assigning static values :
response = {
"stacks": {"5G_L2": [{"Open": "43"},{"Close": "24"}],
"5G_L3": [{"Open": "12"},{"Close": "2"}]
}
};
Debug window showing like :
whereas when assigning the values dynamically like as below :
var datastck=[];
var serverdata = '{{ barCdata | tojson }}';
resPbar = $.parseJSON(serverdata);
$.each(resPbar, function (i, item) {
var di={};
di[item.Team]=[{"Open": item.Open},{"Close": item.Close}];
datastck.push(di);
});
response = {
"stacks": datastck
};
Debug window be like :
it is adding one extra layer of array .I need to have the static assignment structure to support the echarts, Someone Advice please?
Thanks in Advance.


Try this: