Skip to content

Instantly share code, notes, and snippets.

@shumon84
Created August 28, 2018 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shumon84/89cea221c91846b3f86e3708b77df09b to your computer and use it in GitHub Desktop.
Save shumon84/89cea221c91846b3f86e3708b77df09b to your computer and use it in GitHub Desktop.
package main
import (
"encoding/json"
"fmt"
)
type Profile struct {
Name string `json:"name"`
Age int `json:"age"`
Height float64 `json:"height"`
}
func main() {
prof := Profile{
Name: "Yamada Tarou",
Age: 18,
Height: 178.5,
}
profJson, _ := json.Marshal(prof)
fmt.Println(string(profJson))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment