From 406a509fa3626fa6f20c7a6e73699ef15a22facd Mon Sep 17 00:00:00 2001 From: Javier Provecho Date: Wed, 2 Jul 2014 11:53:45 +0200 Subject: [PATCH] Extra example --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1239620f..8a051d05 100644 --- a/README.md +++ b/README.md @@ -190,14 +190,15 @@ func main() { r.GET("/moreJSON", func(c *gin.Context) { // You also can use a struct var msg struct { - Name string + Name string `json:"user"` Message string Number int } msg.Name = "Lena" msg.Message = "hey" msg.Number = 123 - // Will output : {"Name": "Lena", "Message": "hey", "Number": 123} + // Note that msg.Name becomes "user" in the JSON + // Will output : {"user": "Lena", "Message": "hey", "Number": 123} c.JSON(200, msg) })