title: About using JSON with PHP
body: <p>I have a problem that I can not solve. JQuery works with getJSON, php does not work with foreach. The error I get in PHP:</p>
  
  <p>Notice: Trying to get property of non-object in C:\xampp\htdocs\plreserv\index.php on line 14
  Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\plreserv\index.php on line 14</p>
  
  <p>JSON output from the service:</p>
  
  <pre><code>{
      dataList: [
          {
              Date:'11.08.2017',
              Com:'Spr',
              BlsId:'5',
              Type:'break',
              TypeCheck:'0,5',
              perma:'Normal',
              CommaDetail:'0,,,particle,0,,,7',
              Pom:[
                  {
                      Num:'1',
                      status:'1',
                      val:'37349',
                      lang:'tr'
                  },
                  {
                      Num:'2',
                      status:'1',
                      val:'37350',
                      lang:'ru'
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>My php code:</p>
  
  <pre><code>$file = file_get_contents(url);
  $json = json_decode($file);
  foreach($json as $data):
  // code
  endforeach;
  </code></pre>
  
  <p>There are 18 pages like this and none of them work in PHP. This is the error I get from the JSON viewer:</p>
  
  <p><a href="https://i.stack.imgur.com/ile2M.png" rel="nofollow noreferrer">Image attachment</a></p>
  
  <p>I'm sorry for my bad english. Thanks.</p>