September 2017
Intermediate to advanced
466 pages
9h 33m
English
This subsection will teach you how to convert regular data into JSON format in order to send it over a network connection. The Go code of this subsection will be saved as writeJSON.go and will be presented in four parts.
The first chunk of Go code is the expected preamble of the program as well as the definition of two new struct types named Record and Telephone, respectively:
package main
import (
"encoding/json"
"fmt"
"os"
)
type Record struct {
Name string
Surname string
Tel []Telephone
}
type Telephone struct {
Mobile bool
Number string
}
Read now
Unlock full access