add nested object support

@dominictarr would you mind reviewing? :)