Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- import "encoding/json"
- type Test struct {
- Test1 string
- Test2 string `json:"special_json_name"`
- test3 string
- }
- func main() {
- a := Test{"hi", "yeah", "can't be exported :("}
- a.Test2 = "whatttt!"
- b, _ := json.Marshal(a)
- fmt.Println(string(b))
- }
Add Comment
Please, Sign In to add comment