c# - How to tell JSON.NET to deserialize JArray to a List<object> when object type is provided? -
let's have following class:
class foo { public object any; } this class accepts in field any.
when call:
jsonconvert.deserializeobject<foo>("{any: 5}") any contains system.int64.
however, when call:
jsonconvert.deserializeobject<foo>("{any: [5]}") any contains newtonsoft.json.linq.jarray.
how configure json.net in case any contain list<object>?
clarification:
there anything, can call:
jsonconvert.deserializeobject<foo>("{any: 'c'}") or
jsonconvert.deserializeobject<foo>("{any: ['c', 5]}") more clarification:
i tell somehow json.net (maybe using jsonserializersettings):
when encounter
object, json contains array, deserialize (for instance)list<object>.
Comments
Post a Comment