You can use Newtonsoft.Json library in C#
You need to create the corresponding Classes with the matching property names as that of the json array in C# in order to deserialize the json string to C# objects.
See the following code.
namespace StackOverflow.Test
{
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main(string[] args)
{
var json = "{\n \"data\": [\n {\n \"listid\": \"123\",\n \"name\": \"Name\"\n }\n ]\n}";
var lists = JsonConvert.DeserializeObject(json, typeof(Lists)) as Lists;
var list = lists.Data.FirstOrDefault();
Console.WriteLine("Name: " + list.Name);
Console.WriteLine("List Id: " + list.ListId);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
class Lists
{
public List<Info> Data { get; set; }
}
class Info
{
public string ListId { get; set; }
public string Name { get; set; }
}
}
JsonConvertisjson.net. I just fixed tags. And to OP, please show your code and error if you want us to help you.