Advertisement
Guest User

Untitled

a guest
Nov 20th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using Newtonsoft.Json;
  3.  
  4. namespace Test
  5. {
  6.     class EmailData
  7.     {
  8.         public int Type { get; set; }
  9.     }
  10.  
  11.     class ApiData
  12.     {
  13.         [JsonProperty("request.id")]
  14.         public int? RequestId { get; set; }
  15.  
  16.         [JsonProperty("list")]
  17.         public Dictionary<string, EmailData> EmailDictionary { get; set; }
  18.     }
  19.  
  20.     class Program
  21.     {
  22.         static void Main(string[] args)
  23.         {
  24.             var data = JsonConvert.DeserializeObject<ApiData>(@"  
  25.                             {
  26.                              ""request.id"": null,
  27.                              ""list"": {
  28.                                ""email1@email.com"": {
  29.                                  ""Type"": ""1""
  30.                                },
  31.                                ""email2@email.com"": {
  32.                                  ""Type"": ""1""
  33.                                },
  34.                                ""email3@email.com"": {
  35.                                  ""Type"": ""1""
  36.                                }
  37.                              }
  38.                            }"
  39.                         );
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement