stream-parser
stream-parser copied to clipboard
Start reading from a specific node in the json
How do you say you want to go a specific node in the json to begin parsing? For e.g. in the example json file below, I want it to only read the data array
{
"headers": {
"col1": "id1",
"col1": "id2",
},
"data": [
{
"name": "John"
},
{
"name": "Julie"
}
]
}
If I do something like this it starts reading from the very beginning of the json and throws an error
$filename = 'abc.json';
StreamParser::json(storage_path($filename))->each(function(Collection $record){
dd($record);
});
Can they be an implementation to do something like this (so it starts reading only data)?
$filename = 'abc.json';
StreamParser::json(storage_path($filename), 'data')->each(function(Collection $record){
dd($record);
});
anything here?
PRs are highly welcomed