I managed to get it working with a little hack.
The code on the first endpoint remains the same; the list of rewards is serialized using JsonConvert.SerializeObject(rewards)
.
On the second endpoint, I define the type of the rewards
as a string
instead of a List<Reward>
. It shows up as an escaped json string. From there, I explicitly use JsonConvert.DeserializeObject<List<Reward>>(rewards)
to convert into the list.