autorest: Anonymous types are not getting properly serialized
The below request gets converted,
var extendedData = new[]
{
new { Name = "foo", Value = 1 },
new { Name = "bar", Value = 2 },
};
request.ExtendedData = extendedData;
into following JSON
{"Data":"test","Monitoring":true,"ExtendedData":[{},{}]}
with SafeJsonConvert.SerializeObject. It works as expected with JsonConvert.Serialize method of JSON.NET.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (11 by maintainers)
I’ve just found this and solved it by created a CustomInitialize that changes the contract resolver.
My code is now working!
Thanks for the details @keerthivasanm
I’ve made sure this issue is being triaged by the right people.
FYI @markcowl