Class JsonConverter
This utility class is designed to make JSON related conversions easier to work with.
Inheritance
Namespace: Cuemon.Runtime.Serialization
Assembly: Cuemon.Runtime.dll
Syntax
public static class JsonConverter
Fields
| Improve this DocNullValue
Represents the null literal as defined in RFC 4627.
Declaration
public static readonly string NullValue
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this DocJsonAsciiConverter
The function delegate that will handle JSON ASCII conversions.
Declaration
public static Func<int, string> JsonAsciiConverter { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.Int32, System.String> |
JsonUnicodeConverter
The function delegate that will handle JSON Unicode conversions.
Declaration
public static Func<int, string> JsonUnicodeConverter { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.Int32, System.String> |
Methods
| Improve this DocEscape(String)
JSON escapes the specified value
using the two function delegates; JsonAsciiConverter and JsonUnicodeConverter.
Declaration
public static string Escape(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The System.String to escape. |
Returns
Type | Description |
---|---|
System.String | A JSON escaped System.String that is equivalent to |
ToString(Boolean)
Returns the boolean value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Byte)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Byte[])
Returns the string value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
Remarks
value
is converted to a Base64 encoded string.
ToString(Char)
Returns the string value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(char value)
Parameters
Type | Name | Description |
---|---|---|
System.Char | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(DateTime)
Returns the string value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Decimal)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Double)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Guid)
Returns the string value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(Guid value)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Int16)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Int32)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Int64)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Object)
Returns the value of a JSON object.
Declaration
public static string ToString(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
Remarks
value
is checked and written accordingly by the System.IConvertible interface.
ToString(Object, Type)
Returns the value of a JSON object.
Declaration
public static string ToString(object value, Type valueType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value of the JSON object. |
System.Type | valueType | The type of the |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
Remarks
value
is checked and written accordingly by the System.IConvertible interface.
ToString(SByte)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(sbyte value)
Parameters
Type | Name | Description |
---|---|---|
System.SByte | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(Single)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(String)
Returns the string value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(UInt16)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(UInt32)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |
ToString(UInt64)
Returns the numeric value of a JSON object as defined in RFC 4627.
Declaration
public static string ToString(ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | value | The value of the JSON object. |
Returns
Type | Description |
---|---|
System.String | A System.String representation of |