I´m using C# MVC and have the following JSON:
MessageType: "Type1"
MessageData: {{Name: "Jonas"}, Phones: [{ Fixed: "12345", Mobile: "45678" }], Addresses: [{ Home: "ababa"} ... ], { HasId: "Yes }, ... }
The MessageData
will contain different data depending on MessageType
.
What I need is to deserialize it into the following C# structure:
public class AjaxMsg
{
public string MessageType { get; set; }
public object MesssageData { get; set; }
}
I´m using the native serialization during the POST from client, but I only get the MessageType
data.
Also, the code:
var msgDataString = MessageData.ToString()
returns "System.Object"
How can I get the MessageData
accordingly as an object format ?