Files
Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Examples/DeserializeDictionary.cs
T
James Newton-King 68eacc480b -JSON Schema fixes
-Fixed static values being included with fields serialization
-Examples! (work in progress)
2013-01-23 21:39:54 +13:00

27 lines
603 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples
{
public class DeserializeDictionary
{
public void Example()
{
string json = @"{
""href"": ""/account/login.aspx"",
""target"": ""_blank""
}";
Dictionary<string, string> htmlAttributes = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
Console.WriteLine(htmlAttributes["href"]);
// /account/login.aspx
Console.WriteLine(htmlAttributes["target"]);
// _blank
}
}
}