| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| b := []byte(`{"Name":"Wednesday","Age":6,"Parents":["Gomez","Morticia"]}`) |
| err := json.Unmarshal(b, &f) |
| expected := map[string]interface{}{ |
| "Parents": []interface{}{ |
| if !reflect.DeepEqual(f, expected) { |
| log.Panicf("Error unmarshalling %q, expected %q, got %q", b, expected, f) |
| f = map[string]interface{}{ |
| "Parents": []interface{}{ |
| m := f.(map[string]interface{}) |
| fmt.Println(k, "is string", vv) |
| fmt.Println(k, "is int", vv) |
| fmt.Println(k, "is an array:") |
| fmt.Println(k, "is of a type I don't know how to handle") |