title: how to read from json array in codeingiter
body: <p>Im trying to decode json and get value from the json code.</p>
  
  <pre><code>[{
      "restaurant_id":1,
      "menu_template_id":2,
      "add_food_item_a":1,
      "menu_category_id":1,
      "status":0
  } ,
  {
      "restaurant_id":1,
      "menu_template_id":2,
      "add_food_item_a":2,
      "menu_category_id":1,
      "status":0
  }]
  </code></pre>
  
  <p>i need to read from this json and create an array with  add_food_item_a and status.</p>
  
  <p>currently I'm using like this</p>
  
  <pre><code>public function readJson()
      {
          $json_obj = json_decode('');
          if (isset($GLOBALS["HTTP_RAW_POST_DATA"]) &amp;&amp; !empty($GLOBALS["HTTP_RAW_POST_DATA"])) {
              $json_text = $this-&gt;cleanMe($GLOBALS["HTTP_RAW_POST_DATA"]);
              // now insert into user table
              $json_obj = json_decode($json_text);
          }
          return $json_obj;
      }
  </code></pre>
  
  <p>and I call this function like</p>
  
  <pre><code>$add_food_item_a = isset($json_obj-&gt;add_food_item_a) ? $json_obj-&gt;add_food_item_a : '';
  </code></pre>
  
  <p>but can't read from this array of json code</p>