Laravel 5: LengthAwarePaginator returned JSON not array
<p>I'm returning JSON from LengthAwarePaginator but the JSON's <code>data</code> property is not an array. I need it to be an array. Any ideas?</p>

<pre><code>// grab query parameters
$pageNumber = $request-&gt;input('page');
$pageSize = $request-&gt;input('pageSize');
// if query params do not exist call with defaults
if(!$pageNumber) {
  $pageNumber = 1;
}

if(!$pageSize) {
  $pageSize = 5;
}

$offset = ($pageNumber * $pageSize) - $pageSize;
// slice full array data based on page number and page size
$itemsForCurrentPage = array_slice($arrayOfData, $offset, $pageSize, true);
return new LengthAwarePaginator($itemsForCurrentPage, count($this-&gt;orgUsers), $pageSize, $pageNumber);
</code></pre>

<p>Returned data:</p>

<pre><code>{
"total": 30,
"per_page": 5,
"current_page": 2,
"last_page": 6,
"next_page_url": "/?page=3",
"prev_page_url": "/?page=1",
"from": 6,
"to": 10,
"data": {
    "5": {
    "userId": "564110eadcb39832268ea873",
    "email": "dsdfgdfg@il.com",
    "isActive": true,
    "firstName": "dsdfgdfg",
    "lastName": "dsdfgdfg",
    "permissionType": "dsdfgdfg"
    },
    "6": {
    "userId": "564110ea2169bc358a3b65c2",
    "email": "dsdfgdfg@d.com",
    "isActive": false,
    "firstName": "dsdfgdfg",
    "lastName": "dsdfgdfg",
    "permissionType": "dsdfgdfg"
    },
    "7": {
    "userId": "564110eaee662f30c4bd6772",
    "email": "dsdfgdfg@dsdfgdfg.com",
    "isActive": true,
    "firstName": "dsdfgdfg",
    "lastName": "dsdfgdfg",
    "permissionType": "dsdfgdfg"
    },
    "8": {
    "userId": "dsdfgdfg",
    "email": "dsdfgdfg@dsdfgdfg.com",
    "isActive": true,
    "firstName": "dsdfgdfg",
    "lastName": "dsdfgdfg"
    },
    "9": {
    "userId": "564110eaf9526eb5ddd673a4",
    "email": "dsdfgdfg@dsdfgdfg.com",
    "isActive": true,
    "firstName": "dsdfgdfg",
    "lastName": "dsdfgdfg"
    }
}
}
</code></pre>

<p>TIA  </p>