PHP JSON String, escape Single - Double Quotes



$escaped_data = json_encode($php_data, JSON_HEX_QUOT | JSON_HEX_APOS);
$escaped_data = str_replace(['\u0022', '\u0027'], ['\\'', '\''], $escaped_data);

https://stackoverflow.com/questions/7462394/php-json-string-escape-double-quotes-for-js-output