Name string
Age uint8
}
app.Get("/json", func(c *fiber.Ctx) error {
// Create data struct:
Name: "Grame",
Age: 20,
}
return c.JSON(data)
// => Content-Type: application/json
return c.JSON(fiber.Map{
"name": "Grame",
"age": 20,
})
// => Content-Type: application/json
})