Created
November 17, 2015 19:26
-
-
Save xyproto/fef32b00bbcdafc08c76 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
"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