2

I have a struct like this:

type User struct {
  Login         string    `json:",string"`
  PasswordNonce Nonce     `json:",string"`
  PasswordHash  HashValue `json:",string"`
  CreatedOn     time.Time `json:",string"`
  Email         string    `json:",string"`
  PhoneNumber   string    `json:",string"`
  UserId        Id        `json:",string"`
}

The code that generates the JSON and sends it is the following:

func AddUserHandler(w http.ResponseWriter, r *http.Request) {
    var userRecord model.User
    encoder := json.NewEncoder(w)
    err = encoder.Encode(userRecord)
    if err != nil {
        panic(err)
    }
}

When I encode it with the Golang built in JSON encoder, the field names appear without quotes, which prevents the JSON.parse function in node.js from reading the content.
Does anyone know a solution to that?

Thanks!