PHP json_decode from POST variable produced by JavaScript

I had issues with perfectly looking JSON string received from a POST. Not in any way using Chrome devtools (F12) nor saving the source from the browser and using Notepad I could detect that the double quotes actually was not real quotes until I investigated the the ASCII value using ord() and substr() and it returned 38 as in "&", then I understood it was a HTML entity.

Converting the JSON with html_entity_decode() made the trick.


echo "<br>ascii: ".ord(substr($sample_grid['grid']['packages'], 1, 1))."</br>";

$json = html_entity_decode($sample_grid['grid']['packages']);

Knowledge keywords: