From 9ea9e0fd5178d0e28d79ca2f594e1cb1fb962e9f Mon Sep 17 00:00:00 2001 From: Javier Provecho Date: Wed, 2 Jul 2014 11:47:55 +0200 Subject: [PATCH] Fix JSON Struct example --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index baebc795..1239620f 100644 --- a/README.md +++ b/README.md @@ -190,12 +190,15 @@ func main() { r.GET("/moreJSON", func(c *gin.Context) { // You also can use a struct var msg struct { + Name string Message string - Status int + Number int } + msg.Name = "Lena" msg.Message = "hey" - msg.Status = 200 - c.JSON(200, msg.Status) + msg.Number = 123 + // Will output : {"Name": "Lena", "Message": "hey", "Number": 123} + c.JSON(200, msg) }) r.GET("/someXML", func(c *gin.Context) {