Last active
November 14, 2018 08:39
-
-
Save nikita8/13f2d4f945e5a566128dff69a83e78a2 to your computer and use it in GitHub Desktop.
JSON encoding in GO
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
// Go | |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
// Go | |
mapA := map[string]int{"apple": 5, "lettuce": 7} | |
// encoding map type to json strings | |
mapB, _ := json.Marshal(mapA) | |
fmt.Println(string(mapB)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment