Am sure your JSON code above 500 has a formatting issue , have used JSON with over 20,000 values here is a simple script of 2000 array
$string = "Sample String Data ¶";
$string = preg_replace( '/[^[:print:]]/', '',$string); // remove all values that can affect JSON
$array = array();
for($i = 0 ; $i < 2000; $i++)
{
if(mt_rand(0, 1))
{
$array[] = $string ;
}
else
{
$array[] = array($string,1,$string) ;
}
}
$json = json_encode($array);
$decodeArray = json_decode($json);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo ' - No errors';
break;
case JSON_ERROR_DEPTH:
echo ' - Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
echo ' - Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
echo ' - Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
echo ' - Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
echo ' - Unknown error';
break;
}
echo "<br />" ;
foreach ($decodeArray as $key => $value) {
print_r($value) ;
flush();
}
Edit 2
I was so interested to know if there is any limitation .. just tested it with 250,000 (Two hundred and fifty thousand values and it works fine )
Thanks
Oleku
var_dump($decode)give you?var_dump($decode)to see typejson_last_error()[edit: requires PHP >= 5.3!] to determine what exactly went wrong: php.net/manual/en/function.json-last-error.php