I have a large sized JSON string of about 1 GB for example a JSON like
$someJSON = '[{"name":"Jonathan Suh","gender":"male"},{"name":"William
Philbin","gender":"male"},{"name":"Allison McKinnery","gender":"female"}]';
I don't want to use json_decode
to convert it to a PHP array as the JSON array is about 1 GB in size and it decoding fails with 500 error Is it possible to break the JSON into smaller portions
$string1 = {"name":"Jonathan Suh","gender":"male"}
$string2 = {"name":"William Philbin","gender":"male"}
$string3 = {"name":"Allison McKinnery","gender":"female"}
and then convert it to an Array using json_decode
for each variable of $string1, $string2 etc?
I cannot Split the array also as it will take more time. Maybe something like scanning the JSON, storing to an array and then discarding the array using unset()
line by line so that the memory will be freed after processing the array