1

What do I do can change the variable array two dimensions as object. I write with 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"

To:

{    
    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"
      }
}

I want to use it to send data json_encode. Help me with a solution.

MaTaDoRcpe
  • 79
  • 1
  • 1
  • 8
  • I believe your question is aleady answered here: https://stackoverflow.com/questions/4215737/convert-array-to-object –  Jun 15 '17 at 05:00
  • 1
    Possible duplicate of [Convert Array to Object](https://stackoverflow.com/questions/4215737/convert-array-to-object) – Kiran Pawar Jun 15 '17 at 06:39

0 Answers0