官术网_书友最值得收藏!

  • 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)
}
主站蜘蛛池模板: 柞水县| 资溪县| 洪泽县| 孟津县| 贺兰县| 凤阳县| 小金县| 白沙| 屏南县| 自治县| 伽师县| 卢湾区| 仙居县| 孟津县| 宁陵县| 雷波县| 甘德县| 嘉义县| 错那县| 蒙山县| 南宁市| 沂水县| 遂昌县| 乌海市| 娱乐| 瑞安市| 廊坊市| 巴马| 勐海县| 德州市| 河津市| 和平县| 海宁市| 廊坊市| 康定县| 永清县| 延安市| 玉溪市| 丹阳市| 江口县| 南澳县|