0

I have a 50 MB size json file that I am calling with PHP and it takes ages to load. Is there a way to stream it better than fully load it to the memory ?

if yes, the Json contains 2D arrays like this :

[[x,y,z],[x,y,z],.....],[[x,y,z],[x,y,z],.....]

how to call 50 2D arrays each time ?

Also is there a more efficient way than using json please tell me. I am using a webscraping JS scripts to collect data from websites and save them in a json file.

Skyliquid
  • 374
  • 1
  • 5
  • 23
  • Dear Katarina, please provide us with a little insight of your file structure. You can post your php code here you know. – Piotr Dajlido Mar 17 '15 at 16:17
  • `$jsonIterator = new RecursiveIteratorIterator( new RecursiveArrayIterator(json_decode($json, TRUE)), RecursiveIteratorIterator::SELF_FIRST);` where `$json` is reading from file using `fopen` and `fread` – Skyliquid Mar 17 '15 at 16:22
  • Are you serious?? Edit your post and put your code there not in the comment section. – Piotr Dajlido Mar 17 '15 at 16:23
  • Possible duplicate of [How to write javascript in client side to receive and parse \`chunked\` response in time?](http://stackoverflow.com/questions/6789703/how-to-write-javascript-in-client-side-to-receive-and-parse-chunked-response-i) – Paul Sweatte Jan 21 '17 at 03:00

0 Answers0