Update JSON data that is stored in Database
<p>I have JSON data that is stored in a variable which is a set of permissions for a particular user. The JSON data however, is not stored in a file, it's just in a database column.</p>

<p>I've tried to look for a method of updating a permission (which is either true or false) but I've had no luck thus far. At the moment, I have something to the effect of;</p>

<p><em>The raw JSON data...</em></p>

<pre><code>{
    "permissions": {
        "permission_1": true,
        "permission_2": false
    }
}
</code></pre>

<p><em>Getting it out of the database...</em></p>

<pre><code>$permissions = json_decode($data, true);
</code></pre>

<p>How do I (using PHP) update the JSON data to say, update permission 2 to true? I'm using <code>json_decode()</code> when it comes out of the database and putting it into an array but that's only for using it. After that I'm lost as to how to update the value.</p>