bindiego
6/10/2015 - 3:32 AM

JSON

JSON

var pkgs = [
    {
      pkgid: "abc123",
      discount_percent: 10,
      maps:[
        {
          key: "cs_notes",
          value: "abc\ntest\tgogogo"
        },
        {
          key: "quote",
          value: "lalala"
        },
        {
          key: "job_fee_final",
          value: 100
        }
      ]
    },
    {
      pkgid: "xyz123",
      discount_percent: 15,
      maps: [
        {
          key: "cs_notes",
          value: "xyz"
        },
        {
          key: "quote",
          value: "lalala"
        },
        {
          key: "job_fee_final",
          value: 200
        }
      ]
    }
  ];


for (var pkg in pkgs) {
  console.log(pkgs[pkg].pkgid);
  console.log(pkgs[pkg].discount_percent);
  
  for (var map in pkgs[pkg].maps) {
    console.log(pkgs[pkg].maps[map].key);
    console.log(pkgs[pkg].maps[map].value);
  }
}