How to PUT repeated pair of data in single request?

I have a structure like this:
{
“code”: 0,
“text”: “”,
“error”: “”,
“data”: [
{
“name”: “add_byte_in”,
“value”: “100000000”,
},
{
“name”: “add_byte_out”,
“value”: “0”}]}
To modify it I’ve made this request:

PUT {URL}
raw/json:
{ “data”: [
{
“name”: “add_byte_in”,
“value”: “10”,
},
{
“name”: “add_byte_out”,
“value”: “10”}]}
And now I have an error “json: cannot unmarshal array into Go struct field .data of type SystemParam”

Does your endpoint work as expected if you hit it outside of Postman?

I found this StackOverflow article that has the same error message as yours.

I don’t know how finicky Go is, but looking at your JSON, you have an extra comma after your “value” property in your first data object. That potentially could be causing your issue.

1 Like