Created
May 5, 2020 15:30
-
-
Save weinung-chiu/a04be3959457719cd7062d44820ee587 to your computer and use it in GitHub Desktop.
CharlieCC_JSON
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
a := map[string]interface{} {"name": "Charlie", "age": 20} | |
b := map[string]interface{} {"name": "Charlie", "age": 20} | |
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b)) | |
fmt.Printf("(%T) %v\n", b["age"], b["age"]) | |
err := json.Unmarshal([]byte(`{"name": "Charlie", "age": 20}`), &b) | |
if err != nil { | |
panic("oops") | |
} | |
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b)) | |
fmt.Printf("(%T) %v\n", b["age"], b["age"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment