title: JSON string to PHP array NULL
body: <p>Here is my code:</p>
  
  <pre><code>    var_dump(json_decode($data['event']-&gt;options['meals']['options'][0]['option'], true));
      echo '&lt;br /&gt;';echo '&lt;br /&gt;';
      var_dump($data['event']-&gt;options['meals']['options'][0]['option']);
      echo '&lt;br /&gt;';echo '&lt;br /&gt;';
      var_dump(json_decode('[{"name":"Petit Tenderloin","description":"Wrapped in Apple Wood Bacon, borsoun whipped mashed potatoes, roasted baby vegetable, with sun dried cherry sauce. "},{"name":"Chicken Piccatta","description":"In lemon caper sauce, served with a timbal of wild rice and vegetables. "}]', true));
  </code></pre>
  
  <p>Here is my output:</p>
  
  <pre><code>NULL
  
  string(279) "[{"name":"Petit Tenderloin","description":"Wrapped in Apple Wood Bacon, borsoun whipped mashed potatoes, roasted baby vegetable, with sun dried cherry sauce. "},{"name":"Chicken Piccatta","description":"In lemon caper sauce, served with a timbal of wild rice and vegetables. "}]"
  
  array(2) { [0]=&gt; array(2) { ["name"]=&gt; string(16) "Petit Tenderloin" ["description"]=&gt; string(115) "Wrapped in Apple Wood Bacon, borsoun whipped mashed potatoes, roasted baby vegetable, with sun dried cherry sauce. " } [1]=&gt; array(2) { ["name"]=&gt; string(16) "Chicken Piccatta" ["description"]=&gt; string(72) "In lemon caper sauce, served with a timbal of wild rice and vegetables. " } }
  </code></pre>
  
  <p>Why is it that when I put in a string literal I get the proper array, but when I pass in a variable I get NULL? I feel like I am missing something super simple....</p>
  
  <p><strong>EDIT: Found out reason</strong>
  Looks like the variable has a new line character that naturally doesn't show up in the HTML. Looks like the new line char breaks json_decode...</p>
  
  <p>Anyone know of a way around that other than removing the new lines? (I'd prefer to keep them in if I can) </p>