Skip to content

Instantly share code, notes, and snippets.

@nikita8
Last active November 14, 2018 08:39
Show Gist options
  • Save nikita8/13f2d4f945e5a566128dff69a83e78a2 to your computer and use it in GitHub Desktop.
Save nikita8/13f2d4f945e5a566128dff69a83e78a2 to your computer and use it in GitHub Desktop.
JSON encoding in GO
// 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