.net - How to deserialize json to multiple types dynamically in c# -
this question has answer here:
- deserialize json c# dynamic object? 21 answers
i have json string below :
{ "error" : "xxxx" , "data" : int type or {...other complex json object} }
i don't know when return int or other json string data field , , how deserialize ?
when type of data object or dynamic , real deserialized type of data int or dictionary using javascriptserializer.deserialize(string json).
the real deserialized type of data int64 or jcontainer when using json.net.
is there elegance way solve ? don't think reflection way.
you can create object-wrapper , put data type identificator first field of wrapper.
Comments
Post a Comment