CSharp · Console
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
public class Program
{
public static void Main()
{
string result = @"
{
""kind"": ""internal"",
""name"": ""SplashPageToggle_dg"",
""fullPath"": ""SplashPageToggle_dg"",
""generation"": 1255326,
""selfLink"": ""https://link"",
""type"": ""string"",
""records"": [
{
""name"": ""enable_app1"",
""data"": ""0""
},
{
""name"": ""enable_app2"",
""data"": ""0""
},
{
""name"": ""enable_app3"",
""data"": ""0""
},
{
""name"": ""enable_app4"",
""data"": ""0""
},
{
""name"": ""enable_app5"",
""data"": ""0""
},
{
""name"": ""enable_app6"",
""data"": ""1""
},
{
""name"": ""enable_app7"",
""data"": ""0""
},
{
""name"": ""enable_app8"",
""data"": ""0""
},
{
""name"": ""enable_app9"",
""data"": ""0""
},
{
""name"": ""enable_app10"",
""data"": ""0""
}
]
}";
var splashInfo = JsonConvert.DeserializeObject<RootObject>(result);
Console.WriteLine("kind: " + splashInfo.kind);
Console.WriteLine("name: " + splashInfo.name);
Console.WriteLine("full path: " + splashInfo.fullPath);
Console.WriteLine("generation: " + splashInfo.generation);
Console.WriteLine("self link: " + splashInfo.selfLink);
Console.WriteLine("type: " + splashInfo.type);
foreach (Record rec in splashInfo.records)
{
Console.WriteLine(rec.name + ": " + rec.data);
}
}
}
public class RootObject
{
public string kind { get; set; }
public string name { get; set; }
public string fullPath { get; set; }
public int generation { get; set; }
public string selfLink { get; set; }
public string type { get; set; }
public List<Record> records { get; set; }
}
public class Record
{
public string name { get; set; }
public string data { get; set; }
}