Lesson 19 of 60
GoJSON Marshalling & Unmarshalling
20 minutes
Course progress32%
JSON in Go
This lesson explains the main concept clearly with beginner-friendly examples and background so you can learn why the code works.
The encoding/json package provides Marshal and Unmarshal.
type User struct {
ID int `json:"id"`
Name string
Age
}
u := User{ID: , Name: }
bytes, _ := json.Marshal(u)
fmt.Println((bytes))