Fix an issue with nested properties.

I was having an issue with instances were you have nested properties with the same name. Eg, from ElasticSearch results:

```json
{
  ...
  hits: {
    hits: 10
    ...
  }
}
```

The 'hits.hits' accessor was not working because 'hits' was being replaced globally in the string when it should only replace the first instance when you're using dot notation accessors.

I added tests for a variety of nesting situations I could imagine. All tests are currently passing.