Created
November 12, 2013 20:40
-
-
Save benwoody/7438276 to your computer and use it in GitHub Desktop.
field tags with go Structs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
type MyStruct struct { | |
MyName string `json:"name"` | |
} | |
func (c RenderCorrectJson) Work() revel.Result { | |
json := MyStruct{MyName: "Ben Woodall"} | |
return c.RenderJson(json) | |
} | |
... | |
RESULTS: | |
{ | |
"name": "Ben Woodall" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment