JSON_HEX_APOS
as the second parameter which will convert all single quotes '
to \u0027
. :
var t = <?php echo json_encode($data, JSON_HEX_APOS);?>;
Then use encode ()
and decode ()
javascript functions to convert the text from each array entry back to readable text like this example