28 $empty_key = sha1(microtime(
true) . mt_rand());
30 $this->token = $empty_key;
55 $json = preg_replace(
'~([^"\\\\])""\\s*\\:~',
"$1\"{$this->token}\":", $json, -1,
$count);
57 return json_decode($json, $assoc, $depth,
$options);
78 if (is_string($json)) {
79 $json = str_replace(
"\"{$this->token}\"",
'""', $json);
getEmptyKey()
Get the key that represents an empty string key in JSON.
__construct($empty_key= '')
Constructor.
decode($json, $assoc=false, $depth=512, $options=0)
Decode JSON while converting empty keys to a unique token.
encode($value, $options=0, $depth=512)
Encode JSON while converting unique token keys to empty strings.