Class JsonUtility
Namespace:Microsoft.DocAsCode.Common
Assembly:Microsoft.DocAsCode.Common.dll
Syntax
public static class JsonUtility
Fields
DefaultSerializer
Declaration
public static readonly ThreadLocal<JsonSerializer> DefaultSerializer
Field Value
Type |
Description |
ThreadLocal<Newtonsoft.Json.JsonSerializer> |
|
Methods
Deserialize<T>(TextReader, JsonSerializer)
Declaration
public static T Deserialize<T>(TextReader reader, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
TextReader |
reader |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Returns
Type Parameters
Deserialize<T>(String, JsonSerializer)
Declaration
public static T Deserialize<T>(string path, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
String |
path |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Returns
Type Parameters
FromJsonString<T>(String, JsonSerializer)
Declaration
public static T FromJsonString<T>(this string json, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
String |
json |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Returns
Type Parameters
Serialize(TextWriter, Object, Formatting, JsonSerializer)
Declaration
public static void Serialize(TextWriter writer, object graph, Formatting formatting = Formatting.None, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
TextWriter |
writer |
|
Object |
graph |
|
Newtonsoft.Json.Formatting |
formatting |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Declaration
public static string Serialize(object graph, Formatting formatting = Formatting.None, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
Object |
graph |
|
Newtonsoft.Json.Formatting |
formatting |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Returns
Declaration
public static void Serialize(string path, object graph, Formatting formatting = Formatting.None, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
String |
path |
|
Object |
graph |
|
Newtonsoft.Json.Formatting |
formatting |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Declaration
public static string ToJsonString(this object graph, Formatting formatting = Formatting.None, JsonSerializer serializer = null)
Parameters
Type |
Name |
Description |
Object |
graph |
|
Newtonsoft.Json.Formatting |
formatting |
|
Newtonsoft.Json.JsonSerializer |
serializer |
|
Returns