Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将阵列2d转换为对象[Angularjs]_Angularjs_Arrays_Object - Fatal编程技术网

将阵列2d转换为对象[Angularjs]

将阵列2d转换为对象[Angularjs],angularjs,arrays,object,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

我该怎么做才能将变量数组更改为二维对象。 我用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"
致:

我想用它来发送数据json_encode。
帮助我找到解决方案。

我相信你的问题在这里得到了阿莱迪的回答:可能的重复我相信你的问题在这里得到了阿莱迪的回答:可能的重复
{    
    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"
      }
}