138
1
using System;
2
using System.Collections.Generic;
3
using Newtonsoft.Json;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
string JsonResults =
10
"{\"records\":[{\"PK\":\"1_1_8\",\"ID\":\"8\",\"DeviceID\":\"1\",\"RootID\":\"1\",\"CustName\":\"test1\",\"CustSurname\":\"test2\",\"Address\":\"Nisou 1\",\"City\":\"\",\"ZipCode\":\"\",\"PhoneNumber\":\"45646\",\"HomePhoneNumber\":\"\",\"Email\":\"\",\"Notes\":\"\",\"Owner\":\"1\",\"LanguageID\":\"1\",\"LanguagePK\":\"\",\"DeletedFlag\":\"false\",\"created\":\"2017-10-25 10:15:00\",\"modified\":\"2017-10-25 09:35:43\"},{\"PK\":\"1_1_33\",\"ID\":\"33\",\"DeviceID\":\"1\",\"RootID\":\"1\",\"CustName\":\"\",\"CustSurname\":\"\",\"Address\":\"\",\"City\":\"\",\"ZipCode\":\"\",\"PhoneNumber\":\"\",\"HomePhoneNumber\":\"\",\"Email\":\"\",\"Notes\":\"\",\"Owner\":null,\"LanguageID\":\"0\",\"LanguagePK\":\"\",\"DeletedFlag\":\"true\",\"created\":\"2017-10-25 10:13:54\",\"modified\":\"2017-10-25 10:13:54\"},{\"PK\":\"1_1_16\",\"ID\":\"16\",\"DeviceID\":\"1\",\"RootID\":\"1\",\"CustName\":\"Theodosis\",\"CustSurname\":\"\",\"Address\":\"Dali\",\"City\":\"Nicosia\",\"ZipCode\":\"2540\",\"PhoneNumber\":\"45645\",\"HomePhoneNumber\":\"99123456\",\"Email\":\"theodosis@gmail.com\",\"Notes\":\"\",\"Owner\":\"\",\"LanguageID\":\"1\",\"LanguagePK\":\"\",\"DeletedFlag\":\"false\",\"created\":\"2017-10-25 09:36:22\",\"modified\":\"2017-10-25 09:36:22\"}]}";
11
var observation = JsonConvert.DeserializeObject<DataContainer>(JsonResults);
12
13
foreach(Customer customer in observation.records)
14
Console.WriteLine(customer.PK);
15
}
16
17
public class DataContainer
18
{
19
public List<Customer> records { get; set; }
20
}
21
22
public class Customer
23
{
24
public string PK
Cached Result