将数组2d转换为对象[Angularjs]

时间:2017-06-15 04:57:59

标签: angularjs arrays object

我该怎么做才能将变量数组的两个维度更改为对象。 我用Angularjs写作

[Object, Object, Object]
  0:Object
    Amount :12
    categoryID:"1"
    typeID:"1"
    typeName:"chicken"
  1:Object
    Amount :23
    categoryID:"1"
    typeID:"4"
    typeName:"Bird"
  2:Object
    Amount :12
    categoryID:"1"
    typeID:"5"
    typeName:"swan"

要:

{    
    0:{
        Amount :12
        categoryID:"1"
        typeID:"1"
        typeName:"chicken"
      }
    1:{
        Amount :23
        categoryID:"1"
        typeID:"4"
        typeName:"Bird"
      }
    2:{
        Amount :12
        categoryID:"1"
        typeID:"5"
        typeName:"swan"
      }
}

我想用它来发送数据json_encode。 帮我解决一下。

0 个答案:

没有答案