Rename nested keys of array
<p>I need change values of nested arrays to use plugin </p>

<p><a href="https://github.com/khan4019/tree-grid-directive" rel="nofollow">https://github.com/khan4019/tree-grid-directive</a></p>

<p>My JSON looks like this:</p>

<pre><code>[{"Id":13,"Name":"sadas","Users":[],"Managers":[],"Departments":[{"Id":14,"Name":"hgjghjghjg","Users":[],"Managers":[],"Departments":[{"Id":16,"Name":"kjk","Users":[],"Managers":[],"Departments":[{"Id":17,"Name":"vcxv","Users":[],"Managers":[],"Departments":[]}]}]},{"Id":15,"Name":"p[op[","Users":[],"Managers":[],"Departments":[]}]}]
</code></pre>

<p>To use angular plugin need rename every key <code>Departments to children</code>, and remove <code>""</code> from keys. </p>

<p>I try to use Json.stringify, and replace like in default string </p>

<pre><code>var objToSend = JSON.stringify(response.Departments);
var str = objToSend.replace("\"Departments\":", "\"children\":");
$rootScope.tree_data = str;
</code></pre>

<p>but its no worked for me, its just change first key of array, but not nested and return </p>

<pre><code>[{"Id":13,"Name":"sadas","Users":[],"Managers":[],"children":[{"Id":14,"Name":"hgjghjghjg","Users":[],"Managers":[],"Departments":[{"Id":16,"Name":"kjk","Users":[],"Managers":[],"Departments":[{"Id":17,"Name":"vcxv","Users":[],"Managers":[],"Departments":[]}]}]},{"Id":15,"Name":"p[op[","Users":[],"Managers":[],"Departments":[]}]}]
</code></pre>