[Solved] How to save Json Array to Java script array


You need to do something like this:

var object = {"class_section":{"classess":["PG1","PG2"],"sections":{"PG1":["A","B"],"PG2":["A","B"]}}};


var classess = object.class_section.classess;
var sections = [];


sectionsArray = object.class_section.sections;

for(var index in sectionsArray) {
  sections[index] = sectionsArray[index];
}

At the end the classess and sections variables should have the desired values.

0

solved How to save Json Array to Java script array