How can I convert a json array to an array of structs? Example:
[
{"name": "Rob"},
{"name": "John"}
]
I'm retrieving the json from a request:
body, err := ioutil.ReadAll(r.Body)
How would I unmarshal this into an array?
How can I convert a json array to an array of structs? Example:
[
{"name": "Rob"},
{"name": "John"}
]
I'm retrieving the json from a request:
body, err := ioutil.ReadAll(r.Body)
How would I unmarshal this into an array?
如何将json数组转换为结构数组? 示例: p>
[
{“ name”:“ Rob”},
{“ name”:“ John”}
]
code> < / pre>
我正在从请求中检索json: p>
body,err:= ioutil.ReadAll(r.Body)
< / code> pre>
如何将其解组为数组? p>
div>