In addition to Solution 1 and 2, try the below code which uses
JavaScriptSerializer Class [
^] for Deserialization,
Please add the reference
System.Web.Extensions.dll
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace CPTemp
{
public class Class1
{
static void Main(string[] args)
{
string input = "{\"Errors\":[{\"Code\":123,\"Message\":\"Your account is Linked\"}]}";
JavaScriptSerializer js = new JavaScriptSerializer();
ErrorInfo obj = js.Deserialize<ErrorInfo>(input);
foreach (ErrorDescription item in obj.Errors)
{
string message = item.Message;
int code = item.Code;
}
}
}
public class ErrorDescription
{
public string Message { get; set; }
public int Code { get; set; }
}
public class ErrorInfo
{
public List<ErrorDescription> Errors { get; set; }
}
}