Lesson 36 of 60
GoEncoding & Decoding – JSON, XML, and Gob
20 minutes
Course progress60%
JSON (most common)
This lesson explains the main concept clearly with beginner-friendly examples and background so you can learn why the code works.
type Person struct {
Name string `json:"name"`
Age int `json:"age"`
}
p := Person{"Bob", }
bytes, _ := json.Marshal(p)
fmt.Println((bytes))