Laravel create a JSON array
<p>Trying to create a JSON array for Morris.js donut chart, but cant think of any way to get correct format. Any tips?</p>

<p>My controller:</p>

<pre><code>    $user = User::find((Auth::user()-&gt;id));
    $budget = $user-&gt;budget()-&gt;get();
    $labels = ['rent', 'heating', 'utilities', 'internet_tv', 'phone', 'food', 'sweets', 'alcohol_cigs', 'insurance'        , 'loans', 'finance_other', 'cosmetics'
                , 'medicine', 'clothes_shoes', 'accessories', 'electronics', 'school', 'entertainment', 'food_out', 'holidays', 'books', 'pets', 'gifts', 'car', 'other'];
    $data2 = [];
    foreach ($labels as $label)
    {
        $data2['label'][] = $label;
        $data2['value'][] = $budget-&gt;sum($label);
    }
    $data2 = json_encode($data2);
</code></pre>

<p>What I am getting:</p>

<pre><code>'{"label":["rent","heating","utilities","internet_tv" ...],"value":[435,30,0,0 ...]}'
</code></pre>

<p>I want to get:</p>

<pre><code>'[{"label":"rent","value":"435"},{"label":"heating","value":"30"},{"label":"utilities","value":"0"},{"label":"internet_tv","value":"0"} ...]'
</code></pre>