Skip to content

Instantly share code, notes, and snippets.

@drewfreyling
Last active December 25, 2015 18:09
Show Gist options
  • Save drewfreyling/7018165 to your computer and use it in GitHub Desktop.
Save drewfreyling/7018165 to your computer and use it in GitHub Desktop.
[TestMethod]
public void DeserializeTest()
{
const string json = "{\"a\":\"test\"}"; //already stringifyied
var result = ServiceStack.Text.JsonSerializer.DeserializeFromString<dynamic>(json);
Assert.AreEqual("test", result.a);
}
[TestMethod]
public void SerializeTest()
{
const string json = "{\"a\":\"test\"}";
var notjson = new { a = "test" };
var result = ServiceStack.Text.JsonSerializer.SerializeToString(notjson);
Assert.AreEqual(json, result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment