$new_array = []; foreach($obje as $item){ $new_array[$item->key] = $item->graphql->user->edge_followed_by->count; }