Skip to content

Instantly share code, notes, and snippets.

@charlie-chiu
Created May 5, 2020 15:30
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 charlie-chiu/a04be3959457719cd7062d44820ee587 to your computer and use it in GitHub Desktop.
Save charlie-chiu/a04be3959457719cd7062d44820ee587 to your computer and use it in GitHub Desktop.
CharlieCC_JSON
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