Given a JavaScript object,

```
var obj = { a: { b: '1', c: '2' } }

```

and a string

```
"a.b"

```

how can I convert the string to dot notation so I can go

```
var val = obj.a.b

```

If the string was just `'a'`, I could use `obj[a]`. But this is more complex. I imagine there is some straightforward method, but it escapes me at present.