-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
48 lines (37 loc) · 1.41 KB
/
Program.cs
File metadata and controls
48 lines (37 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RestSharp.Deserializers;
using System.IO;
using ChatRoom.Models;
namespace ChatRoom
{
public class Program
{
/// <summary>
/// On Console Application mode, this standalone program gets called and does the deserialization for the JSON input string
/// The whole record could be viewed in the debug mode.
/// </summary>
public static void Main()
{
RestSharp.RestResponse restResponse = new RestSharp.RestResponse();
restResponse.Content = File.ReadAllText("JSONData.txt"); ;
RestSharp.Deserializers.JsonDeserializer jsonDeserializer = new JsonDeserializer();
Record record = jsonDeserializer.Deserialize<Record>(restResponse);
Console.WriteLine(record.has_title.ToString());
Console.WriteLine(record.title.ToString());
foreach (List<Object> item in record.entries)
{
Console.WriteLine(item[0].ToString());
IDictionary<string, Object> recordContent;
recordContent = item[1] as IDictionary<string,Object>;
foreach (var records in recordContent.Values)
{
Console.WriteLine(records.ToString());
}
}
Console.ReadLine();
}
}
}