I am writing a C# wrapper for a RESTful JSON API, and using Json.NET to deserialize the incoming json to strongly typed object. but a few properties in the incoming json are
You should use ExpandoObjectConverter
instead.
You need to type your IDictionary<string, object>
as just dynamic
and decorate the whole property with [JsonConverter(typeof(ExpandoObjectConverter))]
.
One interesting detail is ExpandoObject
also implements IDictionary<string, object>
, but when you type it with dynamic
, you can access associated properties like regular ones! ;)