Skip to content

Instantly share code, notes, and snippets.

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 xyproto/fef32b00bbcdafc08c76 to your computer and use it in GitHub Desktop.
Save xyproto/fef32b00bbcdafc08c76 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"encoding/json"
)
func main() {
mapSI := map[string]int{"x": 2}
mapSS := map[string]string{"y": "hello"}
everything := make(map[string]interface{})
for k, v := range mapSI {
everything[k] = v
}
for k, v := range mapSS {
everything[k] = v
}
fmt.Println(everything)
by, err := json.Marshal(everything)
if err != nil {
log.Fatalln(err)
}
fmt.Println(string(by))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment