I have a return result which is in JSON format. I use JSON.parse on this to convert it to an array (mydata). I then have a string such as "/a/b/c" which would map to mydata["a"]["b"]["c"]. I would like to be able to change the value pointed at by "/a/b/c". My issue is how do I access this so the final value pointed to can be modified?

I was thinking along the lines of

```
var mydata = JSON.parse( json_string );
var newValue = 2;
var path="a/b/c";
var s = path.split("/");
var ptr = mydata;
for( int ii=0; ii < s.length; ii++ ) {
    ptr = ptr[ s[ii] ];
}
ptr = newValue;

```

But this does not work for obvious reasons. What could I do to make this work?