In GoLang, one can alias JSON for serializing and serializing/de-serializing:
type Response struct {
TaskID string `json:"task_id"`
...
}
...
func Run(task structs.Task) {
msg := structs.Response{}
msg.TaskID = task.TaskID
resp, _ := json.Marshal(msg)
...
}
json:"task_id" is the alias for the struct field TaskID with the string type in the Response struct of the GoLang example above. This alias can be used to serialize the struct data into JSON as exemplified in json.Marshal(msg)
How can one accomplish this in Julia?