Help editing JSON to make an array rather than a 'dictionary'

后端 未结 2 638
情书的邮戳
情书的邮戳 2020-12-12 04:57

I currently have json using json_encode from a mysql query which looks like this:

{\"post_2\":{\"caption\":\"...\",\"id\":\"...\",\"accountID\":\"..\",\"date         


        
2条回答
  •  悲&欢浪女
    2020-12-12 05:58

    Provide a non-associative array to json_encode(). The easiest way is usually to simply call array_values() on the (associative) array, and encode the result.

提交回复
热议问题