Remove element from multidimensional array

后端 未结 6 1726
情歌与酒
情歌与酒 2021-01-13 06:10

I have following multidimensional array:

{\"2\":{\"cid\":\"2\",\"uid\":\"2\"},\"1\":{\"cid\":\"1\",\"uid\":\"3\"}}

In this example i want t

6条回答
  •  执念已碎
    2021-01-13 06:56

    Assign your Object (not an Array) to a variable, this way:

    var o = {"2":{"cid":"2","uid":"2"},"1":{"cid":"1","uid":"3"}};
    

    Then do:

    delete o['1'];
    

    That's it!

提交回复
热议问题