Deserialize a JSON array in C#
This should work...
JavaScriptSerializer ser = new JavaScriptSerializer();var records = new ser.Deserialize<List<Record>>(jsonData);public class Person{ public string Name; public int Age; public string Location;}public class Record{ public Person record;}
This code is working fine for me,
var a = serializer.Deserialize<List<Entity>>(json);
[JsonProperty("name")]public string name { get; set; }[JsonProperty("Age")]public int required { get; set; }[JsonProperty("Location")]public string type { get; set; }
and Remove a "{"..,
strFieldString = strFieldString.Remove(0, strFieldString.IndexOf('{'));
DeserializeObject..,
optionsItem objActualField = JsonConvert.DeserializeObject<optionsItem(strFieldString);