JSON
Byte 轉為 JSON
func GetUserAssets(c *fiber.Ctx) error {
url := "https://api.....io/api/v1/assets...."
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
var data interface{}
json.Unmarshal(body, &data)
return c.Status(fiber.StatusCreated).JSON(fiber.Map{
"data": data,
"success": true,
"message": "User assets get successfully",
})
}Struct to JSON
快速 JSON 轉為 struct 的工具
Last updated