title: How to get String value from json_decode in php
body: <p>My json-data is as follows -</p>
  
  <pre><code>[{"name": "ram"}]
  </code></pre>
  
  <p><strong>What I want is the value of <code>name</code> in a variable</strong> e.g., <code>$fname</code>. I have tried -</p>
  
  <pre><code>&lt;?php
  $jsondata = '[{"name": "ram"}]';
  //$obj = json_decode($jsondata);
  $obj = json_decode($jsondata,true);
  print_r($obj); // This line outputs as :- Array ( [0] =&gt; Array ( [name] =&gt; ram ) ) 
  //What I need is value of key
  print_r($obj['name']);
  foreach ($obj as $k=&gt;$v){
  echo $v;
  }
  ?&gt;
  </code></pre>
  
  <p>But I am unable to get desired output.</p>