title: Read JSON objects with Matlab
body: <p>I want to read from a json file with Matlab and store everything in "data" as objects. After import, I need to iterate through all and extract specific values, if it's available in the object.</p>
  
  <p><strong>JSON (source):</strong></p>
  
  <pre><code>{
      "eid": 44000, 
      "dpm_id": {
          "dpm": "fm", 
          "pwr": "main"
      }, 
      "fpga_id": 3189637128, 
      "fpga_ver": 3104379702, 
      "boot_id": 0, 
      "pbs_ver": "PBS 2012-05-07 16:41"
  }
  {
      "sid": 1, 
      "hk1": {
          "bela_mode": "pbs_mode", 
          "pbs_version": "version 1.3", 
          "scet": "2038-01-19T03:14:08", 
          "ref_time": "0:00:00", 
          "tc_received": 2, 
          "tc_exec": 2, 
          "tc_err_ack": 0, 
          "tc_err_exec": 1, 
          "tm_total": 1, 
          "tm_sent": 1, 
          "tm_dropped": 0,
          ....
  </code></pre>
  
  <p><strong>Matlab (import, <a href="http://www.mathworks.com/matlabcentral/fileexchange/42236-parse-json-text/content/example/html/usage.html" rel="noreferrer">according to this website, resp. Class</a>):</strong></p>
  
  <pre><code>fname = 'FileName.json';
  fid = fopen(fname);
  raw = fread(fid,inf);
  str = char(raw');
  fclose(fid);
  
  data = JSON.parse(str)
  </code></pre>
  
  <p><strong>Problem/Question:</strong></p>
  
  <p>As you see, Matlab only reads the content of the first brackets/field. How can I import ALL brackets/fields, even if I don't know how many there are?</p>
  
  <pre><code>data = 
  
           eid: 44000
        dpm_id: [1x1 struct]
       fpga_id: 3.1896e+09
      fpga_ver: 3.1044e+09
       boot_id: 0
       pbs_ver: 'PBS 2012-05-07 16:41'
  </code></pre>
  
  <p>Thank you!</p>