如何使用JavaScript创建嵌套数组以获取多个账单?

时间:2018-09-26 07:56:02

标签: javascript jquery arrays

我想使用JavaScript获取多个账单的嵌套数组。在下面,我粘贴了我们获得的输入样本

enter image description here

var out = [{"tax":"CGST@9%","percent":"106.78"},{"tax":"SGST@9%","percent":"106.78"},{"tax":"SGST@2.5%","percent":3.57},{"tax":"CGST@2.5%","percent":3.57}];
var name = Sarath H;
var mobile = 9916751978;
var payment = Paytm;
var products = [{"product_code":"AMO-73","item":"AM VG Credit-5","quantity":"1","price":"1000","price_display":"847.46","tax":"18","taxgroup_name":"GST@18%","tax_linked":",25,26"},{"product_code":"AMO-77","item":"Roller coaster","quantity":2,"price":"200","price_display":"169.49","tax":"18","taxgroup_name":"GST@18%","tax_linked":",25,26"},{"product_code":"AMO-78","item":"Dancing car","quantity":"1","price":"150","price_display":"142.86","tax":"5","taxgroup_name":"GST@5%","tax_linked":",29,30"}];
var tax = [{"tax":"CGST@9%","percent":"76.27"},{"tax":"SGST@9%","percent":"76.27"},{"tax":"CGST@9%","percent":"30.51"},{"tax":"SGST@9%","percent":"30.51"},{"tax":"SGST@2.5%","percent":"3.57"},{"tax":"CGST@2.5%","percent":"3.57"}]
var total = 1550.00;

1 个答案:

答案 0 :(得分:0)

您可以创建

之类的对象数组
var bills = [
   {
     address: 'bil1',
     billdate: '',
     ....
     data_product: [
        {
          adssd: 'asdas'
          ....
        }
        ....
     ],
     .....
}, {
     address: 'bil2',
     billdate: '',
     ....
     data_product: [
        {
          adssd: 'asdas'
        } 
     ],
     ...
}

]

这是您需要的吗?否则请提供更多说明