Last active
August 29, 2015 14:23
-
-
Save TryingToImprove/81c13f2a7b0b01a26e6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Newtonsoft.Json; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var dict = new Dictionary<string, string>(); | |
dict.Add("username", "test"); | |
dict.Add("name", "test"); | |
var serialized = JsonConvert.SerializeObject(dict); | |
Console.WriteLine(serialized); //= { "username": "test", "name": "test" } | |
var dummy = JsonConvert.DeserializeObject<Dictionary<string, string>>(serialized); | |
Console.WriteLine(2 == dummy.Count); //= True | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment