Parse value from http web response stream

It is easy using Json.Net. Just declare your concrete classes and then deserialize.

var root = JsonConvert.DeserializeObject<RootObject>(yourJsonString);

foreach (var item in root.TotalUsersCount)

var allusers = root.TotalUsersCount.Sum(u => u.TotalUsers);

public class TotalUsersCount
    public int AccountStatus { get; set; }
    public int TotalUsers { get; set; }
    public int MemberUsers { get; set; }
    public int CrimsonUsers { get; set; }

public class RootObject
    public List<TotalUsersCount> TotalUsersCount { get; set; }

You can also use the built-in System.Web.Script.Serialization.JavaScriptSerializer

var root = new JavaScriptSerializer().Deserialize<RootObject>(yourJsonString);

Browse More Popular Posts

Leave a Comment