Support encoding Structs nested inside Arrays and Slices

I was using encoder for a project but needed to support arrays of structs nested inside a root struct to comply with http://jsonapi.org/. Something like this:

```go
type Thing struct {
  Id: int `json:"id"`
  Name: string `json:"name"`
}

type ApiResponse struct {
  Things: []Thing `json:"things"`
}
```