19 lines
301 B
Go
19 lines
301 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
jb := []byte(`{"property": "test"}`)
|
|
params := map[string]interface{}{"foo": 1}
|
|
if err := json.Unmarshal(jb, ¶ms); err != nil {
|
|
panic("marshal failed.")
|
|
}
|
|
fmt.Println(params["foo"], params["property"])
|
|
}
|
|
|
|
// Output:
|
|
// 1 test
|