Based on my understanding of this subject, I’ve come up with the following function for translating a string from PHP to JSON, strictly conforming to the RFC4627. function json_string($string) { //http://www.ietf.org/rfc/rfc4627.txt $replacements = array( ‘@[\\\\"]@’ => ‘\\\\$0′, //escape backslashes and…