First of all, I appreciate there are lots of answers regarding dealing with large JSON files. However, I have yet to find one that encounters my scenario.
The problem I face is that I have large JSON files (12mb) that look like this:
{
"range": "Sheet1!A1:P40571",
"majorDimension": "ROWS",
"values": [
[
"new_id",
"qty",
"total_job_cost",
"total_job_revenue",
"total_job_profit",
"total_job_margin"
],
[
"34244",
"5",
"211.25",
"297.00",
"85.75",
"28.87%"
],
[
"34244",
"10",
"211.25",
"297.00",
"85.75",
"28.87%"
],
...
]
}
And I wish to extract out the values array, and convert it into a csv that would like this:
new_id,total_job_cost,total_job_revenue,total_job_profit,total_job_margin
34244,211.25,297.00,85.75,28.87%
34245,211.25,297.00,85.75,28.87%
...
However, since the values array is so large, when I try to extract it using a PHP library for JSON parsing, my server crashes when it tries to read it.
Any suggestions or tips appreciated. Thanks.