I am sure that your JSON code above 500 has a formatting problem, used JSON with more than 20,000 values, here is a simple script from an array of 2000
$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 interested to know if there are any restrictions .. just checked it with 250,000 (Two hundred and fifty thousand values ββand it works fine)
Thanks Oleku
source share