So I have some JSON string that I write to a file, and parse it afterwards, for an export/import tool the problem is on import when I try to parse the file using json_decode it dies because of the caracter escaping.
Here I have an example so you can understand better:

When I write the content I do some basic file_put and json_encode
eg:
$current .= "\n\n\n".'$pagzDynamicPages = \''.json_encode($pagzDynamicPagesData).'\';';
So is there a way to escape this type of strings?