-2

I have a json string like below :

{ "error" : "xxxx" , "data" : int type or {...other complex json object} }

I don't know when return int or other json string from data field , and how to deserialize this ?

when type of data is object or dynamic , the real deserialized type of data is int or Dictionary using JavaScriptSerializer.Deserialize(string json).

the real deserialized type of data is Int64 or JContainer when using Json.Net.

is there a elegance way to solve this ? I don't think reflection is a good way.

1

1 Answer 1

1

You can create object-wrapper and put data type identificator to the first field of this wrapper.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.