Created
August 28, 2018 08:14
-
-
Save shumon84/89cea221c91846b3f86e3708b77df09b to your computer and use it in GitHub Desktop.
This file contains 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
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