super-user super-user - 1 year ago 209
JSON Question

JSON to C# a Dynamic List<object> or DataTable

Short version: How can I deserialize a JSON string into a C# list or DataTable without having a defined class to deserialize to?

More explanation: My controller expects a json string which is an array of objects but the properties of the object is unknown. I need to deserialize it into a list and loop through its contents for saving. Sample json strings:





Answer Source
dynamic jsonObject = System.Web.Helpers.Json.Decode(jsonText);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download