Level 6
You could do it with the following structure:
// Decode the JSON into a PHP array, then into a Laravel collection object
$data = collect(json_decode($json, true));
// Group the items by their author, then remap the structure to gather the books from each item using pluck()
$data->groupBy('Author_ID')
->map(function ($author, $index) {
return [
'Author_ID' => $index,
'Books' => $author->pluck('Book')->toArray(),
]
})
->values()
->toArray();