<p>I would like to convert the following string into an array/nested array: </p>

<pre><code>str = "[[this, is],[a, nested],[array]]"

newarray = # this is what I need help with!

newarray.inspect  # =&gt; [['this','is'],['a','nested'],['array']]
</code></pre>

Looks like a basic parsing task. Generally the approach you are going to want to take is to create a recursive function with the following general algorithm
```
```
base case (input doesn't begin with '[') return the input
recursive case:
    split the input on ',' (you will need to find commas only at this level)
    for each sub string call this method again with the sub string
    return array containing the results from this recursive method
```
```
The only slighlty tricky part here is splitting the input on a single ','. You could write a separate function for this that would scan through the string and keep a count of the openbrackets - closedbrakets seen so far. Then only split on commas when the count is equal to zero.