Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 720 Bytes

ToString.md

File metadata and controls

21 lines (17 loc) · 720 Bytes

Write JSON text with JToken.ToString

This sample converts LINQ to JSON objects to JSON.

var o = JObject.Parse("{'string1':'value','integer2':99,'datetime3':'2000-05-23T00:00:00'}");

Console.WriteLine(o.ToString());
// {
//   "string1": "value",
//   "integer2": 99,
//   "datetime3": "2000-05-23T00:00:00"
// }

Console.WriteLine(o.ToString(Formatting.None));
// {"string1":"value","integer2":99,"datetime3":"2000-05-23T00:00:00"}

snippet source | anchor