i wanted to structure my JSON response for better readability but it encounters error
expected ‘;’ found EOF
return c.Status(fiber.StatusOK).JSON(fiber.Map{
“message”: “Succes retrieving book data”,
“data”: fiber.Map{
“id”: book.Book.Id,
“title”: book.Book.Title,
“author”: book.Book.Author,
“genres”: book.Book.Genres,
“synopsis”: book.Book.Synopsis,
“releaseYear”: book.Book.ReleaseYear,
“available”: book.Available,
},
})
and it is funny that if i put extra } the error is gone, even though the brackets doesn’t add up
return c.Status(fiber.StatusOK).JSON(fiber.Map{
“message”: “Succes retrieving book data”,
“data”: fiber.Map{
“id”: book.Book.Id,
“title”: book.Book.Title,
“author”: book.Book.Author,
“genres”: book.Book.Genres,
“synopsis”: book.Book.Synopsis,
“releaseYear”: book.Book.ReleaseYear,
“available”: book.Available,
},
})}
the { is 2 but the } is 3, and the code worked, im confused
i have tried putting commas, use other structure etc
1