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

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)
}
主站蜘蛛池模板: 科技| 石城县| 玉溪市| 建湖县| 辽阳市| 顺平县| 两当县| 鹤峰县| 渝中区| 白水县| 绵竹市| 镇江市| 平江县| 灵石县| 洛川县| 堆龙德庆县| 关岭| 济南市| 凤庆县| 四子王旗| 河源市| 宝清县| 三台县| 永胜县| 柯坪县| 文水县| 鹤山市| 开远市| 香格里拉县| 黔东| 即墨市| 富阳市| 吴江市| 海盐县| 团风县| 南阳市| 阿城市| 潞城市| 香港 | 伊吾县| 喀喇沁旗|