Skip to content

Instantly share code, notes, and snippets.

@TryingToImprove
Last active August 29, 2015 14:23
Show Gist options
  • Save TryingToImprove/81c13f2a7b0b01a26e6a to your computer and use it in GitHub Desktop.
Save TryingToImprove/81c13f2a7b0b01a26e6a to your computer and use it in GitHub Desktop.
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