0

So I have a large (and I mean absolutely enormous) object that I'm grabbing with curl through php (curlopt), and normally I'd json_decode it into an object (or json_decode true for an array), but it's so enormous that I can't actually fit it all in memory, and need to do it piecemeal.

But how do I do this, exactly? I can limit the depth, but this is a pretty breadthy json object, so it doesn't do too much to help. (And I do eventually need to trawl all the information in this object, so not sure what to do there)

Any thoughts?

Kwahn
  • 446
  • 2
  • 12
  • 4
    https://github.com/salsify/jsonstreamingparser – Blue Dec 05 '17 at 16:49
  • http://php.net/manual/en/function.json-decode.php json_decode has a depth parameter. Try is at depth 1, then loop through and decode the ones you want. – bassxzero Dec 05 '17 at 16:51
  • @FrankerZ Basically perfect - don't know why my searches couldn't find it. Thank you! I'll have to look over the code to make sure it fits in production, but should be okay. – Kwahn Dec 05 '17 at 16:52

0 Answers0