Monday, July 31, 2023

Go (golang) howto not to export fields of a struct when Unmarshal to json object

Use:

typedef MyData struct {

    Data            string    `json:"data"`   

    FieldName   *int64   `json:"-"` 

}

Adding the `json:"-"` will make the Unmarshal command disregard this field

No comments:

Post a Comment