json_decode function is not part of PHP 5.1, so I cannot use it. Is there any other function for this version?
The Zend framework has Zend_Json. At least it used to a couple of years ago.
http://framework.zend.com/download
You can just pull out the JSON library and use it in a standalone manner.
<?php
if ( !function_exists('json_decode') ){
function json_decode($json)
{
// Author: walidator.info 2009
$comment = false;
$out = '$x=';
for ($i=0; $i<strlen($json); $i++)
{
if (!$comment)
{
if ($json[$i] == '{' || $json[$i] == '[') $out .= ' array(';
else if ($json[$i] == '}' || $json[$i] == ']') $out .= ')';
else if ($json[$i] == ':') $out .= '=>';
else $out .= $json[$i];
}
else $out .= $json[$i];
if ($json[$i] == '"') $comment = !$comment;
}
eval($out . ';');
return $x;
}
}
?>
this is untested, I found it on the internet
http://www.php.net/manual/en/function.json-decode.php#91216