My structures are not marshalling into json

You have to make the fields that you want to marshal public. Like this:

type Address struct {
  Street string
  Extended string
  City string
  State string
  Zip string
}

err is nil because all the exported fields, in this case there are none, were marshalled correctly.

Working example: https://play.golang.org/p/9NH9Bog8_C6

Check out the docs http://godoc.org/encoding/json/#Marshal


Note that you can also manipulate what the name of the fields in the generated JSON are by doing the following:

type Name struct {
  First string `json:"firstname"`
  Middle string `json:"middlename"`
  Last string `json:"lastname"` 
}

Tags:

Json

Go