| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "encoding/json" |
| 5 | "fmt" |
| 6 | ) |
| 7 | |
| 8 | func main() { |
| 9 | jb := []byte(`{"property": "test"}`) |
| 10 | params := map[string]interface{}{"foo": 1} |
| 11 | if err := json.Unmarshal(jb, ¶ms); err != nil { |
| 12 | panic("marshal failed.") |
| 13 | } |
| 14 | fmt.Println(params["foo"], params["property"]) |
| 15 | } |
| 16 | |
| 17 | // Output: |
| 18 | // 1 test |