title: How to convert JSON string to array
body: <p>What I want to do is the following:</p>
  
  <ol>
  <li>taking JSON as input from text area in php </li>
  <li>use this input and convert it to JSON and pass it to php curl to send request.</li>
  </ol>
  
  <p>this m getting at php from get of api this json  string i want to pass to json but it is not converting to array </p>
  
  <pre><code>echo $str='{
          action : "create",
          record: {
              type: "n$product",
              fields: {
                  n$name: "Bread",
                  n$price: 2.11
              },
              namespaces: { "my.demo": "n" }
          }
      }';
      $json = json_decode($str, true);
  </code></pre>
  
  <p>the above code is not returning me array.</p>