- Machine Learning With Go
- Daniel Whitenack
- 70字
- 2021-07-08 10:37:27
JSON output
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)
}
推薦閱讀
- Mastering Entity Framework Core 2.0
- 小程序?qū)崙?zhàn)視頻課:微信小程序開發(fā)全案精講
- 跟小海龜學(xué)Python
- Mastering PHP Design Patterns
- Mastering Python High Performance
- MySQL數(shù)據(jù)庫基礎(chǔ)實例教程(微課版)
- 深入淺出Serverless:技術(shù)原理與應(yīng)用實踐
- WebRTC技術(shù)詳解:從0到1構(gòu)建多人視頻會議系統(tǒng)
- Java:High-Performance Apps with Java 9
- Java編程的邏輯
- C語言程序設(shè)計
- LabVIEW虛擬儀器程序設(shè)計從入門到精通(第二版)
- Python+Office:輕松實現(xiàn)Python辦公自動化
- Java核心編程
- Android初級應(yīng)用開發(fā)