How to SetResult() an array of struct? #534
-
I am desperately trying to automatically unmarshall data of the form
My code is basically
The response is OK as I get an expected size ( I tried all kinds of combinations with pointers, trying a plain What is the proper incantation to unmarshal this data? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Quick, untested response: This trips up most people new to Go unmarshalling. The HTTP response contains an array, but the response itself is not an array. Try putting the |
Beta Was this translation helpful? Give feedback.
-
For me there was no need to introduce a separate struct
works. I did have to set the return type to json:
|
Beta Was this translation helpful? Give feedback.
For me there was no need to introduce a separate struct
works. I did have to set the return type to json:
SetHeader("Accept", "application/json").