Created
March 26, 2014 17:52
-
-
Save CayasSoftware/9789244 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
namespace jsontest | |
{ | |
class MainClass | |
{ | |
public static void Main( string[] args ) | |
{ | |
var value = new Root() { Foo = "Foo", Child = new Child { Foo = "Foo" } }; | |
string message = JsonConvert.SerializeObject(value); | |
Debug.WriteLine(message); | |
var result = JsonConvert.DeserializeObject<Root>(message); | |
var result1 = JsonConvert.DeserializeObject(message, typeof(Newtonsoft.Json.Linq.JObject)); | |
var r = JsonConvert.DeserializeObject(message, typeof(There.Root)); | |
var remoteRoot = new There.Root(); | |
JsonConvert.PopulateObject(message, remoteRoot); | |
Console.ReadKey(); | |
} | |
} | |
public class Root | |
{ | |
public string Foo { get; set; } | |
public Child Child { get; set; } | |
} | |
public class Child | |
{ | |
public string Foo { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment