PHP decode nested JSON

后端 未结 2 1847
眼角桃花
眼角桃花 2020-12-15 09:37

I\'ve a nested JSON code as (it\'s actually my facebook status updates)

{
   \"data\": [
      {
         \"id\": \"1290561400000000\",
         \"from\": {
         


        
2条回答
  •  失恋的感觉
    2020-12-15 10:39

    You can use the json_decode function to convert it to array and then iterate over the array using foreach loop.

    $array = json_decode($json, true);
    
    foreach($array as $key => $value)
    {
      // your code....
    }
    

    The second option to json_decode is whether or not you want to convert it to an array.

提交回复
热议问题