September 2017
Beginner to intermediate
304 pages
7h 2m
English
Now let's say that we have the Citi Bike station data in our stationData struct value and we want to save that data out to a file. We can do this with json.marshal:
// Marshal the data.outputData, err := json.Marshal(sd)if err != nil { log.Fatal(err)}// Save the marshalled data to a file.if err := ioutil.WriteFile("citibike.json", outputData, 0644); err != nil { log.Fatal(err)}
Read now
Unlock full access