title: How to send a JSON to PHP and decode?
body: <p>I'm trying send a JSON to PHP. In PHP Script I'm trying get this JSON using $_POST but doesn't works, when I try use <code>echo $json</code> does not display value. To test if PHP Script is works I'm using RESTClient of Mozilla Firefox.</p>
  
  <p>How could I send a JSON to PHP using $_POST ?</p>
  
  <p><strong>JSON</strong></p>
  
  <pre><code>{
  "jsondata":{
      "nome":"my name"
  }}
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>&lt;?php
  header('Content-type: application/json');
  header('Access-Control-Allow-Origin: *');
  
  $jsondata = $_POST['jsondata'];
  $data = json_decode($jsondata, true);
  print_r($data);
  
  ?&gt;
  </code></pre>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>&lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined index: jsondata in &lt;b&gt;/opt/lampp/htdocs/TelefonesUteis/ws/add_estado.php&lt;/b&gt; on line &lt;b&gt;6&lt;/b&gt;&lt;br /&gt;
  </code></pre>
  
  <p>Line 6 have-><code>$data = json_decode($jsondata, true);</code></p>
  
  <p><img src="https://i.stack.imgur.com/hkCt3.png" alt="enter image description here"></p>