Class JsonConverter
Converts to and from JSON values.
Inheritance
System.Object
JsonConverter
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: SlugBase.dll
Syntax
public static class JsonConverter
Methods
ToDictionary(JsonObject)
Declaration
public static Dictionary<string, object> ToDictionary(JsonObject value)
Parameters
Returns
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
A copy of value as a System.Collections.Generic.Dictionary<TKey, TValue>.
|
ToJson(Boolean)
Create a JsonAny from a single System.Boolean.
Declaration
public static JsonAny ToJson(bool value)
Parameters
Type |
Name |
Description |
System.Boolean |
value |
|
Returns
ToJson(Dictionary<String, Object>)
Declaration
public static JsonObject ToJson(Dictionary<string, object> obj)
Parameters
Type |
Name |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
obj |
|
Returns
Exceptions
Type |
Condition |
System.ArgumentException |
An object in obj could not be converted to JSON.
|
System.ArgumentNullException |
obj was null .
|
ToJson(List<Object>)
Create a read-only JsonList from a copy of list
.
Declaration
public static JsonList ToJson(List<object> list)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<System.Object> |
list |
|
Returns
Exceptions
Type |
Condition |
System.ArgumentException |
An object in list could not be converted to JSON.
|
System.ArgumentNullException |
list was null .
|
ToJson(Double)
Create a JsonAny from a single System.Double.
Declaration
public static JsonAny ToJson(double value)
Parameters
Type |
Name |
Description |
System.Double |
value |
|
Returns
ToJson(Int16)
Create a JsonAny from a single System.Int16.
Declaration
public static JsonAny ToJson(short value)
Parameters
Type |
Name |
Description |
System.Int16 |
value |
|
Returns
ToJson(Int32)
Create a JsonAny from a single System.Int32.
Declaration
public static JsonAny ToJson(int value)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
Returns
ToJson(Int64)
Create a JsonAny from a single System.Int64. value
is converted to a System.Double, so very large numbers may lose precision.
Declaration
public static JsonAny ToJson(long value)
Parameters
Type |
Name |
Description |
System.Int64 |
value |
|
Returns
ToJson(Single)
Create a JsonAny from a single System.Single.
Declaration
public static JsonAny ToJson(float value)
Parameters
Type |
Name |
Description |
System.Single |
value |
|
Returns
ToJson(String)
Create a JsonAny from a single System.String.
Declaration
public static JsonAny ToJson(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
ToJson(UInt16)
Create a JsonAny from a single System.UInt16.
Declaration
public static JsonAny ToJson(ushort value)
Parameters
Type |
Name |
Description |
System.UInt16 |
value |
|
Returns
ToJson(UInt32)
Create a JsonAny from a single System.UInt32.
Declaration
public static JsonAny ToJson(uint value)
Parameters
Type |
Name |
Description |
System.UInt32 |
value |
|
Returns
ToJson(UInt64)
Create a JsonAny from a single System.UInt64. value
is converted to a System.Double, so very large numbers may lose precision.
Declaration
public static JsonAny ToJson(ulong value)
Parameters
Type |
Name |
Description |
System.UInt64 |
value |
|
Returns
ToJsonAny(Object)
Create a read-only JsonAny from a copy of value
.
Declaration
public static JsonAny ToJsonAny(object value)
Parameters
Type |
Name |
Description |
System.Object |
value |
|
Returns
Exceptions
Type |
Condition |
System.ArgumentException |
An object in the list or dictionary could not be converted to JSON.
|
ToList(JsonList)
Declaration
public static List<object> ToList(JsonList value)
Parameters
Returns
Type |
Description |
System.Collections.Generic.List<System.Object> |
A copy of value as a System.Collections.Generic.List<T>.
|
ToObject(JsonAny)
Create a mutable copy of a JsonAny.
Declaration
public static object ToObject(JsonAny value)
Parameters
Returns
Type |
Description |
System.Object |
A copy of value as a System.Collections.Generic.List<T>, System.Collections.Generic.Dictionary<TKey, TValue>, System.String, System.Boolean, System.Double, or null .
|