Class JsonSerializer
- Namespace
- Alis.Core.Aspect.Data.Json
- Assembly
- Alis.dll
A utility class to serialize and deserialize JSON.
public static class JsonSerializer
Inheritance
Inherited Members
Fields
D2Format
The format
internal const string D2Format = "D2"
Field Value
DateEnd
The date end
internal const string DateEnd = ")\\/\""
Field Value
DateEnd2
The date end
internal const string DateEnd2 = ")/"
Field Value
DateEndJs
The date end js
internal const string DateEndJs = ")"
Field Value
DateFormatsUtc
The date formats utc
internal static readonly string[] DateFormatsUtc
Field Value
- string[]
DateStart
The date start
internal const string DateStart = "\"\\/Date("
Field Value
DateStart2
The date start
internal const string DateStart2 = "/Date("
Field Value
DateStartJs
The date start js
internal const string DateStartJs = "new Date("
Field Value
DefaultFormatterConverter
The formatter converter
internal static readonly FormatterConverter DefaultFormatterConverter
Field Value
EnumFormat
The enum format
internal const string EnumFormat = "D"
Field Value
False
The false
internal const string False = "false"
Field Value
MinDateTime
The utc
internal static readonly DateTime MinDateTime
Field Value
MinDateTimeTicks
The ticks
internal static readonly long MinDateTimeTicks
Field Value
Null
The null
internal const string Null = "null"
Field Value
RoundTripFormat
The round trip format
internal const string RoundTripFormat = "R"
Field Value
ScriptIgnore
The script ignore
internal const string ScriptIgnore = "ScriptIgnore"
Field Value
SerializationTypeToken
The serialization type token
internal const string SerializationTypeToken = "__type"
Field Value
True
The true
internal const string True = "true"
Field Value
X4Format
The format
internal const string X4Format = "{0:X4}"
Field Value
ZeroArg
The zero arg
internal const string ZeroArg = "{0}"
Field Value
Methods
Abs(float)
Abs the value
internal static float Abs(float value)
Parameters
value
float-
The value
Returns
- float
-
The float
AddOffsetHours(DateTime, int)
Adds the offset hours using the specified dt
internal static DateTime AddOffsetHours(DateTime dt, int offsetHours)
Parameters
Returns
- DateTime
-
The dt
AddOffsetMinutes(DateTime, int)
Adds the offset minutes using the specified dt
internal static DateTime AddOffsetMinutes(DateTime dt, int offsetMinutes)
Parameters
Returns
- DateTime
-
The dt
AppendCharAsUnicode(StringBuilder, char)
Appends the char as unicode using the specified sb
internal static void AppendCharAsUnicode(StringBuilder sb, char c)
Parameters
sb
StringBuilder-
The sb
c
char-
The
AppendDefaultCharacter(StringBuilder, char)
Appends the default character using the specified result
internal static void AppendDefaultCharacter(StringBuilder result, char c)
Parameters
result
StringBuilder-
The result
c
char-
The
AppendEscapedCharacter(StringBuilder, char, TextReader, JsonOptions)
Appends the escaped character using the specified result
internal static void AppendEscapedCharacter(StringBuilder result, char nextChar, TextReader reader, JsonOptions options)
Parameters
result
StringBuilder-
The result
nextChar
char-
The next char
reader
TextReader-
The reader
options
JsonOptions-
The options
AppendSpecialCharacter(StringBuilder, char)
Appends the special character using the specified result
internal static void AppendSpecialCharacter(StringBuilder result, char c)
Parameters
result
StringBuilder-
The result
c
char-
The
AppendTimeZoneUtcOffset(TextWriter, DateTime)
Appends the time zone utc offset using the specified writer
internal static void AppendTimeZoneUtcOffset(TextWriter writer, DateTime dt)
Parameters
writer
TextWriter-
The writer
dt
DateTime-
The dt
AppendUnicodeCharacter(StringBuilder, TextReader, JsonOptions)
Appends the unicode character using the specified result
internal static void AppendUnicodeCharacter(StringBuilder result, TextReader reader, JsonOptions options)
Parameters
result
StringBuilder-
The result
reader
TextReader-
The reader
options
JsonOptions-
The options
Apply(object, object, JsonOptions)
Applies the input
internal static void Apply(object input, object target, JsonOptions options = null)
Parameters
input
object-
The input
target
object-
The target
options
JsonOptions-
The options
Apply(IEnumerable, Array, JsonOptions)
Applies the input
internal static void Apply(IEnumerable input, Array target, JsonOptions options)
Parameters
input
IEnumerable-
The input
target
Array-
The target
options
JsonOptions-
The options
Apply(IDictionary, object, JsonOptions)
Applies the dictionary
internal static void Apply(IDictionary dictionary, object target, JsonOptions options)
Parameters
dictionary
IDictionary-
The dictionary
target
object-
The target
options
JsonOptions-
The options
ApplyToArray(object, Array, JsonOptions)
Applies the to array using the specified input
internal static void ApplyToArray(object input, Array array, JsonOptions options)
Parameters
input
object-
The input
array
Array-
The array
options
JsonOptions-
The options
ApplyToDictionary(IDictionary, object, JsonOptions)
Applies the to dictionary using the specified dic
internal static void ApplyToDictionary(IDictionary dic, object target, JsonOptions options)
Parameters
dic
IDictionary-
The dic
target
object-
The target
options
JsonOptions-
The options
ApplyToDictionaryTarget(IDictionary, IDictionary, JsonOptions)
Applies the values from the source dictionary to the target dictionary.
internal static void ApplyToDictionaryTarget(IDictionary targetDictionary, IDictionary sourceDictionary, JsonOptions options)
Parameters
targetDictionary
IDictionary-
The target dictionary to which values are applied
sourceDictionary
IDictionary-
The source dictionary from which values are taken
options
JsonOptions-
The JsonOptions used for type conversion
ApplyToList(object, object, JsonOptions)
Applies the to list using the specified input
internal static void ApplyToList(object input, object target, JsonOptions options)
Parameters
input
object-
The input
target
object-
The target
options
JsonOptions-
The options
ApplyToListTarget(IEnumerable, object, JsonOptions)
Applies the to list target using the specified input
internal static void ApplyToListTarget(IEnumerable input, object target, JsonOptions options)
Parameters
input
IEnumerable-
The input
target
object-
The target
options
JsonOptions-
The options
ApplyToListTarget(object, IEnumerable, ListObject, JsonOptions)
Applies the input to the list target using the specified target.
internal static void ApplyToListTarget(object target, IEnumerable input, ListObject list, JsonOptions options)
Parameters
target
object-
The target
input
IEnumerable-
The input
list
ListObject-
The list
options
JsonOptions-
The options
ApplyToNonDictionaryTarget(object, IDictionary, JsonOptions)
Applies the to non dictionary target using the specified target
internal static void ApplyToNonDictionaryTarget(object target, IDictionary dictionary, JsonOptions options)
Parameters
target
object-
The target
dictionary
IDictionary-
The dictionary
options
JsonOptions-
The options
ApplyToTargetArray(IEnumerable, Array, JsonOptions)
Applies the to target array using the specified input
internal static void ApplyToTargetArray(IEnumerable input, Array target, JsonOptions options)
Parameters
input
IEnumerable-
The input
target
Array-
The target
options
JsonOptions-
The options
ApplyToTargetDictionary(IDictionary, object, JsonOptions)
Applies the to target dictionary using the specified input
internal static void ApplyToTargetDictionary(IDictionary input, object target, JsonOptions options)
Parameters
input
IDictionary-
The input
target
object-
The target
options
JsonOptions-
The options
AreValuesEqual(object, object)
Describes whether are values equal
internal static bool AreValuesEqual(object o1, object o2)
Parameters
Returns
- bool
-
The bool
CalculateDateTime(long, int, int)
Calculates the date time using the specified l
internal static DateTime CalculateDateTime(long l, int offsetHours, int offsetMinutes)
Parameters
Returns
- DateTime
-
The dt
CalculateHoursAndMinutes(int)
Calculates the hours and minutes using the specified offset value
internal static (int, int) CalculateHoursAndMinutes(int offsetValue)
Parameters
offsetValue
int-
The offset value
Returns
CalculateOffset(string, int, out int, out int)
Calculates the offset using the specified text
internal static void CalculateOffset(string text, int tz, out int offsetHours, out int offsetMinutes)
Parameters
text
string-
The text
tz
int-
The tz
offsetHours
int-
The offset hours
offsetMinutes
int-
The offset minutes
CalculateOffset(string, int, out string, out int, out int)
Calculates the offset using the specified ticks
internal static void CalculateOffset(string ticks, int pos, out string updatedTicks, out int offsetHours, out int offsetMinutes)
Parameters
ticks
string-
The ticks
pos
int-
The pos
updatedTicks
string-
The updated ticks
offsetHours
int-
The offset hours
offsetMinutes
int-
The offset minutes
CanReadCharacter(TextReader)
Describes whether can read character
internal static bool CanReadCharacter(TextReader reader)
Parameters
reader
TextReader-
The reader
Returns
- bool
-
The bool
CanUseSpecialConstructor(Type)
Describes whether can use special constructor
private static bool CanUseSpecialConstructor(Type type)
Parameters
type
Type-
The type
Returns
- bool
-
The bool
ChangeType(object, Type, JsonOptions)
Returns a System.Object with a specified type and whose value is equivalent to a specified input object. If an error occurs, a computed default value of the target type will be returned.
public static object ChangeType(object value, Type conversionType, JsonOptions options)
Parameters
value
object-
The input object. May be null.
conversionType
Type-
The target type. May not be null.
options
JsonOptions-
The options to use.
Returns
- object
-
An object of the target type whose value is equivalent to input value.
ChangeType(object, object, Type, JsonOptions)
Changes the type using the specified target
public static object ChangeType(object target, object value, Type conversionType, JsonOptions options = null)
Parameters
target
object-
The target
value
object-
The value
conversionType
Type-
The conversion type
options
JsonOptions-
The options
Returns
- object
-
The object
Exceptions
CheckAndSetOptions(TextWriter, object, ref IDictionary<object, object>, ref JsonOptions)
Checks the and set options using the specified writer
internal static void CheckAndSetOptions(TextWriter writer, object value, ref IDictionary<object, object> objectGraph, ref JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Exceptions
ClearContextIfNotNull(ListObject)
Clears the context if not null using the specified list
internal static void ClearContextIfNotNull(ListObject list)
Parameters
list
ListObject-
The list
ClearList(ListObject)
Clears the list using the specified list
internal static void ClearList(ListObject list)
Parameters
list
ListObject-
The list
ConvertHexCharacterToByte(char)
Converts the hex character to byte using the specified c
internal static byte ConvertHexCharacterToByte(char c)
Parameters
c
char-
The
Returns
- byte
-
The byte
ConvertTicksToDateTime(long)
Converts the ticks to date time using the specified ticks
internal static DateTime ConvertTicksToDateTime(long ticks)
Parameters
ticks
long-
The ticks
Returns
- DateTime
-
The date time
ConvertToTargetType(object, Type, JsonOptions)
Converts the to target type using the specified value
internal static object ConvertToTargetType(object value, Type targetType, JsonOptions options)
Parameters
value
object-
The value
targetType
Type-
The target type
options
JsonOptions-
The options
Returns
- object
-
The object
CreateArrayInstance(Type, int)
Creates the array instance using the specified type
internal static Array CreateArrayInstance(Type type, int elementsCount)
Parameters
Returns
- Array
-
The array
CreateGenericListObject(Type)
Creates the generic list object using the specified type
internal static ListObject CreateGenericListObject(Type type)
Parameters
type
Type-
The type
Returns
- ListObject
-
The list object
CreateInstance(object, Type, int, JsonOptions, object)
Creates the instance using the specified target
internal static object CreateInstance(object target, Type type, int elementsCount, JsonOptions options, object value)
Parameters
target
object-
The target
type
Type-
The type
elementsCount
int-
The elements count
options
JsonOptions-
The options
value
object-
The value
Returns
- object
-
The object
CreateInstanceForInterfaceOrAbstract(Type, object, int, JsonOptions, object)
Creates the instance for interface or abstract using the specified type
internal static object CreateInstanceForInterfaceOrAbstract(Type type, object target, int elementsCount, JsonOptions options, object value)
Parameters
type
Type-
The type
target
object-
The target
elementsCount
int-
The elements count
options
JsonOptions-
The options
value
object-
The value
Returns
- object
-
The object
CreateInstanceFromDictionary(Type, object, int, JsonOptions, object)
Creates the instance from dictionary using the specified type
internal static object CreateInstanceFromDictionary(Type type, object target, int elementsCount, JsonOptions options, object value)
Parameters
type
Type-
The type
target
object-
The target
elementsCount
int-
The elements count
options
JsonOptions-
The options
value
object-
The value
Returns
- object
-
The object
CreateInstanceWithSpecialConstructor(Type, object, int, JsonOptions, string)
Creates the instance with special constructor using the specified type
private static object CreateInstanceWithSpecialConstructor(Type type, object value, int elementsCount, JsonOptions options, string serializationTypeToken)
Parameters
type
Type-
The type
value
object-
The value
elementsCount
int-
The elements count
options
JsonOptions-
The options
serializationTypeToken
string-
The serialization type token
Returns
- object
-
The object
CreateJsonEventArgs(Type, IDictionary, object, JsonOptions, string, object)
Creates the json event args using the specified type
internal static JsonEventArgs CreateJsonEventArgs(Type type, IDictionary dictionary, object value, JsonOptions options, string key, object target)
Parameters
type
Type-
The type
dictionary
IDictionary-
The dictionary
value
object-
The value
options
JsonOptions-
The options
key
string-
The key
target
object-
The target
Returns
- JsonEventArgs
-
The event args
CreateJsonEventArgs(TextWriter, object, IDictionary<object, object>, JsonOptions)
Creates the json event args using the specified writer
internal static JsonEventArgs CreateJsonEventArgs(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- JsonEventArgs
-
The json event args
CreateJsonEventArgsAfterWriteObject(TextWriter, object, IDictionary<object, object>, JsonOptions)
Creates the json event args after write object using the specified writer
internal static JsonEventArgs CreateJsonEventArgsAfterWriteObject(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- JsonEventArgs
-
The json event args
CreateListObjectFromInterfaces(Type)
Creates the list object from interfaces using the specified type
internal static ListObject CreateListObjectFromInterfaces(Type type)
Parameters
type
Type-
The type
Returns
- ListObject
-
The list object
CreateNewIndices(int[])
Creates the new indices using the specified indices
internal static int[] CreateNewIndices(int[] indices)
Parameters
indices
int[]-
The indices
Returns
- int[]
-
The new indices
CreateSerializableObject(Type, Dictionary<string, object>, JsonOptions)
Creates the serializable object using the specified type
internal static ISerializable CreateSerializableObject(Type type, Dictionary<string, object> values, JsonOptions options)
Parameters
type
Type-
The type
values
Dictionary<string, object>-
The values
options
JsonOptions-
The options
Returns
- ISerializable
-
The serializable
CreateSerializationInfo(Type, Dictionary<string, object>)
Creates the serialization info using the specified type
internal static SerializationInfo CreateSerializationInfo(Type type, Dictionary<string, object> values)
Parameters
type
Type-
The type
values
Dictionary<string, object>-
The values
Returns
- SerializationInfo
-
The info
Deserialize(string, Type, JsonOptions)
Deserializes an object from the specified text.
public static object Deserialize(string text, Type targetType = null, JsonOptions options = null)
Parameters
text
string-
The text text.
targetType
Type-
The required target type.
options
JsonOptions-
Options to use for deserialization.
Returns
- object
-
An instance of an object representing the input data.
Deserialize<T>(TextReader, JsonOptions)
Deserializes an object from the specified TextReader.
public static T Deserialize<T>(TextReader reader, JsonOptions options = null)
Parameters
reader
TextReader-
The input reader. May not be null.
options
JsonOptions-
Options to use for deserialization.
Returns
- T
-
An instance of an object representing the input data.
Type Parameters
T
-
The target type.
Deserialize<T>(string, JsonOptions)
Deserializes an object from the specified TextReader.
public static T Deserialize<T>(string text, JsonOptions options = null)
Parameters
text
string-
The text to deserialize.
options
JsonOptions-
Options to use for deserialization.
Returns
- T
-
An instance of an object representing the input data.
Type Parameters
T
-
The target type.
Deserialize(TextReader, Type, JsonOptions)
Deserializes the reader
internal static object Deserialize(TextReader reader, Type targetType = null, JsonOptions options = null)
Parameters
reader
TextReader-
The reader
targetType
Type-
The target type
options
JsonOptions-
The options
Returns
- object
-
The object
DeserializeToTarget(string, object, JsonOptions)
Deserializes data from the specified text and populates a specified object instance.
public static void DeserializeToTarget(string text, object target, JsonOptions options = null)
Parameters
text
string-
The text to deserialize.
target
object-
The object instance to populate.
options
JsonOptions-
Options to use for deserialization.
DeserializeToTarget(TextReader, object, JsonOptions)
Deserializes data from the specified TextReader and populates a specified object instance.
internal static void DeserializeToTarget(TextReader reader, object target, JsonOptions options = null)
Parameters
reader
TextReader-
The input reader. May not be null.
target
object-
The object instance to populate.
options
JsonOptions-
Options to use for deserialization.
EqualsIgnoreCase(string, string, bool)
Determines if two strings are equal, ignoring case.
internal static bool EqualsIgnoreCase(this string source, string target, bool trim = false)
Parameters
source
string-
The source string.
target
string-
The target string to compare with the source string.
trim
bool-
Indicates whether to trim the strings before comparison.
Returns
- bool
-
True if the strings are equal (ignoring case), false otherwise.
EscapeString(string)
Escapes the string using the specified value
public static string EscapeString(string value)
Parameters
value
string-
The value
Returns
- string
-
The string
ExtractOffset(string, out string, out int, out int)
Extracts the offset using the specified ticks
internal static void ExtractOffset(string ticks, out string updatedTicks, out int offsetHours, out int offsetMinutes)
Parameters
ticks
string-
The ticks
updatedTicks
string-
The updated ticks
offsetHours
int-
The offset hours
offsetMinutes
int-
The offset minutes
ExtractTicks(string)
Extracts the ticks using the specified text
internal static string ExtractTicks(string text)
Parameters
text
string-
The text
Returns
- string
-
The string
FindParameterValueForConstructor(ParameterInfo, IDictionary, int, JsonOptions, string)
Finds the parameter value for constructor using the specified parameter
private static object FindParameterValueForConstructor(ParameterInfo parameter, IDictionary dictionary, int elementsCount, JsonOptions options, string serializationTypeToken)
Parameters
parameter
ParameterInfo-
The parameter
dictionary
IDictionary-
The dictionary
elementsCount
int-
The elements count
options
JsonOptions-
The options
serializationTypeToken
string-
The serialization type token
Returns
- object
-
The object
FindSpecialConstructor(Type)
Finds the special constructor using the specified type
private static ConstructorInfo FindSpecialConstructor(Type type)
Parameters
type
Type-
The type
Returns
- ConstructorInfo
-
The constructor info
FindTimeZoneIndex(string)
Finds the time zone index using the specified text
internal static int FindTimeZoneIndex(string text)
Parameters
text
string-
The text
Returns
- int
-
The int
ForceSerializable(object)
Describes whether force serializable
internal static bool ForceSerializable(object obj)
Parameters
obj
object-
The obj
Returns
- bool
-
The bool
FormatAndSetTypeName(Dictionary<string, object>, object)
Formats the type name and sets it in the dictionary.
internal static void FormatAndSetTypeName(Dictionary<string, object> dic, object o)
Parameters
dic
Dictionary<string, object>-
The dictionary.
o
object-
The object containing the type name.
FormatTypeName(object)
Formats the type name using the specified o
internal static string FormatTypeName(object o)
Parameters
o
object-
The
Returns
- string
-
The string
GetAttribute<T>(PropertyDescriptor)
Gets the attribute using the specified descriptor
internal static T GetAttribute<T>(this PropertyDescriptor descriptor) where T : Attribute
Parameters
descriptor
PropertyDescriptor-
The descriptor
Returns
- T
-
The
Type Parameters
T
-
The
GetAttribute<T>(AttributeCollection)
Gets the attribute using the specified attributes
internal static T GetAttribute<T>(this AttributeCollection attributes) where T : Attribute
Parameters
attributes
AttributeCollection-
The attributes
Returns
- T
-
The
Type Parameters
T
-
The
GetDesiredConstructor(Type)
Gets the desired constructor using the specified type
internal static ConstructorInfo GetDesiredConstructor(Type type)
Parameters
type
Type-
The type
Returns
- ConstructorInfo
-
The constructor info
GetEofException(char)
Gets the eof exception using the specified c
internal static JsonException GetEofException(char c)
Parameters
c
char-
The
Returns
- JsonException
-
The json exception
GetEscapedString(char)
Gets the escaped string using the specified c
internal static string GetEscapedString(char c)
Parameters
c
char-
The
Returns
- string
-
The string
GetExpectedCharacterException(long, char)
Gets the expected character exception using the specified pos
internal static JsonException GetExpectedCharacterException(long pos, char c)
Parameters
Returns
- JsonException
-
The json exception
GetExpectedHexCharacterException(long)
Gets the expected hex character exception using the specified pos
internal static JsonException GetExpectedHexCharacterException(long pos)
Parameters
pos
long-
The pos
Returns
- JsonException
-
The json exception
GetGenericArgument(Type, Type)
Gets the generic argument using the specified found interface
internal static Type GetGenericArgument(Type foundInterface, Type definition)
Parameters
Returns
- Type
-
The type
GetHexValue(TextReader, char, JsonOptions)
Gets the hex value using the specified reader
internal static byte GetHexValue(TextReader reader, char c, JsonOptions options)
Parameters
reader
TextReader-
The reader
c
char-
The character to convert
options
JsonOptions-
The options
Returns
- byte
-
The byte
GetItemType(Type)
Gets the type of elements in a collection type.
internal static Type GetItemType(Type collectionType)
Parameters
collectionType
Type-
The collection type.
Returns
- Type
-
The element type or typeof(object) if it was not determined.
GetJsonAttribute(MemberInfo)
Gets the json attribute using the specified pi
internal static JsonPropertyNameAttribute GetJsonAttribute(MemberInfo pi)
Parameters
pi
MemberInfo-
The pi
Returns
- JsonPropertyNameAttribute
-
The json attribute
GetJsonAttributeIgnore(MemberInfo)
Gets the json attribute ignore using the specified pi
internal static JsonIgnoreAttribute GetJsonAttributeIgnore(MemberInfo pi)
Parameters
pi
MemberInfo-
The pi
Returns
- JsonIgnoreAttribute
-
The json ignore attribute
GetListObject(Type, JsonOptions, object, object, IDictionary, string)
Gets the list object using the specified type
internal static ListObject GetListObject(Type type, JsonOptions options, object target, object value, IDictionary dictionary, string key)
Parameters
type
Type-
The type
options
JsonOptions-
The options
target
object-
The target
value
object-
The value
dictionary
IDictionary-
The dictionary
key
string-
The key
Returns
- ListObject
-
The list object
GetNullifiedStringValueByPath(IDictionary<string, object>, string)
Gets a nullified string value from a dictionary by its path. This is useful to get a string value from the object that the untyped Deserialize method returns which is often of IDictionary<string, object> type.
public static string GetNullifiedStringValueByPath(this IDictionary<string, object> dictionary, string path)
Parameters
dictionary
IDictionary<string, object>-
The input dictionary.
path
string-
The path, composed of dictionary keys separated by a . character. May not be null.
Returns
- string
-
The nullified string value or null if not found.
GetObjectName(Attribute)
Gets the object name using the specified att
internal static string GetObjectName(Attribute att)
Parameters
att
Attribute-
The att
Returns
- string
-
The string
GetObjectName(MemberInfo, string)
Gets the object name using the specified member info
internal static string GetObjectName(MemberInfo memberInfo, string defaultName)
Parameters
memberInfo
MemberInfo-
The member info
defaultName
string-
The default name
Returns
- string
-
The object name if found, otherwise the default name
GetObjectName(PropertyDescriptor, string)
Gets the object name using the specified pd
internal static string GetObjectName(PropertyDescriptor pd, string defaultName)
Parameters
pd
PropertyDescriptor-
The pd
defaultName
string-
The default name
Returns
- string
-
The default name
GetOffsetSignPosition(string, int)
Gets the offset sign position using the specified ticks
internal static int GetOffsetSignPosition(string ticks, int startIndex)
Parameters
Returns
- int
-
The int
GetOffsetString(string, int)
Gets the offset string using the specified ticks
internal static string GetOffsetString(string ticks, int pos)
Parameters
Returns
- string
-
The string
GetPosition(TextReader)
Gets the position using the specified reader
internal static long GetPosition(TextReader reader)
Parameters
reader
TextReader-
The reader
Returns
- long
-
The long
GetPositionBasedOnReaderType(TextReader)
Gets the position based on reader type using the specified reader
private static long GetPositionBasedOnReaderType(TextReader reader)
Parameters
reader
TextReader-
The reader
Returns
- long
-
The long
GetSerializationInfo(ISerializable)
Gets the serialization info using the specified serializable
internal static SerializationInfo GetSerializationInfo(ISerializable serializable)
Parameters
serializable
ISerializable-
The serializable
Returns
- SerializationInfo
-
The info
GetStartIndex(string)
Gets the start index using the specified ticks
internal static int GetStartIndex(string ticks)
Parameters
ticks
string-
The ticks
Returns
- int
-
The int
GetStreamReaderPosition(StreamReader)
Gets the stream reader position using the specified sr
internal static long GetStreamReaderPosition(StreamReader sr)
Parameters
sr
StreamReader-
The sr
Returns
- long
-
The long
GetStringReaderPosition(StringReader)
Gets the string reader position using the specified str
internal static long GetStringReaderPosition(StringReader str)
Parameters
str
StringReader-
The str
Returns
- long
-
The long
GetTypeException(long, string, Exception)
Gets the type exception using the specified pos
internal static JsonException GetTypeException(long pos, string typeName, Exception inner)
Parameters
Returns
- JsonException
-
The json exception
GetTypeFromName(TextReader, string, JsonOptions)
Gets the type from name using the specified reader
internal static Type GetTypeFromName(TextReader reader, string typeName, JsonOptions options)
Parameters
reader
TextReader-
The reader
typeName
string-
The type name
options
JsonOptions-
The options
Returns
- Type
-
The type
GetTypeFromText(string)
Gets the type from text using the specified type name
private static Type GetTypeFromText(string typeName)
Parameters
typeName
string-
The type name
Returns
- Type
-
The type
GetUnexpectedCharacterException(long, char)
Gets the unexpected character exception using the specified pos
internal static JsonException GetUnexpectedCharacterException(long pos, char c)
Parameters
Returns
- JsonException
-
The json exception
GetUpdatedTicks(string, int)
Gets the updated ticks using the specified ticks
internal static string GetUpdatedTicks(string ticks, int pos)
Parameters
Returns
- string
-
The string
GetUpdatedValue(ListObject, object)
Gets the updated value using the specified list
internal static object GetUpdatedValue(ListObject list, object defaultValue)
Parameters
list
ListObject-
The list
defaultValue
object-
The default value
Returns
- object
-
The object
HandleAfterWriteObjectCallback(TextWriter, object, IDictionary<object, object>, JsonOptions)
Handles the after write object callback using the specified writer
internal static void HandleAfterWriteObjectCallback(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
HandleArray(object, IEnumerable, Type, JsonOptions)
Handles the array using the specified target
internal static object HandleArray(object target, IEnumerable en, Type conversionType, JsonOptions options)
Parameters
target
object-
The target
en
IEnumerable-
The en
conversionType
Type-
The conversion type
options
JsonOptions-
The options
Returns
- object
-
The object
HandleArrayValue(TextWriter, object, IDictionary<object, object>, JsonOptions)
Describes whether handle array value
internal static bool HandleArrayValue(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleBeforeWriteObjectCallback(TextWriter, object, IDictionary<object, object>, JsonOptions)
Handles the before write object callback using the specified writer
internal static void HandleBeforeWriteObjectCallback(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
HandleBoolValue(TextWriter, object)
Describes whether handle bool value
internal static bool HandleBoolValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleByteArray(string, JsonOptions)
Handles the byte array using the specified string.
internal static object HandleByteArray(string base64String, JsonOptions options)
Parameters
base64String
string-
The base64 string.
options
JsonOptions-
The JSON options.
Returns
- object
-
The byte array if the string can be converted, otherwise the original string.
HandleCharValue(TextWriter, object)
Describes whether handle char value
internal static bool HandleCharValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleCreationException(Type, Exception, JsonOptions)
Handles the creation exception using the specified type
internal static object HandleCreationException(Type type, Exception e, JsonOptions options)
Parameters
type
Type-
The type
e
Exception-
The
options
JsonOptions-
The options
Returns
- object
-
The object
HandleDateTime(object, JsonOptions)
Handles the date time using the specified value
internal static object HandleDateTime(object value, JsonOptions options)
Parameters
value
object-
The value
options
JsonOptions-
The options
Returns
- object
-
The value
HandleDateTimeOffsetValue(TextWriter, object, JsonOptions)
Describes whether handle date time offset value
internal static bool HandleDateTimeOffsetValue(TextWriter writer, object value, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleDateTimeValue(TextWriter, object, JsonOptions)
Describes whether handle date time value
internal static bool HandleDateTimeValue(TextWriter writer, object value, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleDefaultCase(string, TextReader, JsonOptions)
Handles the default case using the specified text
internal static object HandleDefaultCase(string text, TextReader reader, JsonOptions options)
Parameters
text
string-
The text
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- object
-
The object
HandleDictionary(object, Type, IDictionary, JsonOptions)
Handles the dictionary using the specified target
internal static object HandleDictionary(object target, Type conversionType, IDictionary dic, JsonOptions options)
Parameters
target
object-
The target
conversionType
Type-
The conversion type
dic
IDictionary-
The dic
options
JsonOptions-
The options
Returns
- object
-
The instance
HandleDotCase(string)
Handles the dot case using the specified text
internal static object HandleDotCase(string text)
Parameters
text
string-
The text
Returns
- object
-
The object
HandleECase(string)
Handles the e case using the specified text
internal static object HandleECase(string text)
Parameters
text
string-
The text
Returns
- object
-
The object
HandleEnumValue(TextWriter, object, JsonOptions)
Describes whether handle enum value
internal static bool HandleEnumValue(TextWriter writer, object value, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleEscapeCharacter(TextReader, StringBuilder, JsonOptions)
Handles the escape character using the specified reader
internal static void HandleEscapeCharacter(TextReader reader, StringBuilder result, JsonOptions options)
Parameters
reader
TextReader-
The reader
result
StringBuilder-
The result
options
JsonOptions-
The options
HandleException(Exception, JsonOptions)
Handles the exception using the specified ex
internal static void HandleException(Exception ex, JsonOptions options)
Parameters
ex
Exception-
The ex
options
JsonOptions-
The options
HandleFloatDoubleValue(TextWriter, object)
Describes whether handle float double value
internal static bool HandleFloatDoubleValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleGuidValue(TextWriter, object, JsonOptions)
Describes whether handle guid value
internal static bool HandleGuidValue(TextWriter writer, object value, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleIDictionaryValue(TextWriter, object, IDictionary<object, object>, JsonOptions)
Describes whether handle i dictionary value
internal static bool HandleIDictionaryValue(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleIEnumerableValue(TextWriter, object, IDictionary<object, object>, JsonOptions)
Describes whether handle i enumerable value
internal static bool HandleIEnumerableValue(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleInput(IEnumerable, Array, Type, JsonOptions)
Handles the input using the specified input
private static void HandleInput(IEnumerable input, Array target, Type elementType, JsonOptions options)
Parameters
input
IEnumerable-
The input
target
Array-
The target
elementType
Type-
The element type
options
JsonOptions-
The options
HandleListObject(object, IEnumerable, ListObject, Type, object, JsonOptions)
Handles the list object using the specified target
internal static object HandleListObject(object target, IEnumerable en, ListObject lo, Type conversionType, object value, JsonOptions options)
Parameters
target
object-
The target
en
IEnumerable-
The en
lo
ListObject-
The lo
conversionType
Type-
The conversion type
value
object-
The value
options
JsonOptions-
The options
Returns
- object
-
The object
HandleLiteral(string)
Handles the literal using the specified text
internal static object HandleLiteral(string text)
Parameters
text
string-
The text
Returns
- object
-
The object
HandleNonString(object, object, Type, JsonOptions)
Handles the non string using the specified target
internal static object HandleNonString(object target, object value, Type conversionType, JsonOptions options)
Parameters
target
object-
The target
value
object-
The value
conversionType
Type-
The conversion type
options
JsonOptions-
The options
Returns
- object
-
The value
HandleNullValue(Type, object)
Handles the null value using the specified conversion type
internal static object HandleNullValue(Type conversionType, object value)
Parameters
Returns
- object
-
The object
HandleNullValue(TextWriter, object)
Describes whether handle null value
internal static bool HandleNullValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleNumericValue(TextWriter, object)
Describes whether handle numeric value
internal static bool HandleNumericValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleObjectGraph(TextWriter, object, IDictionary<object, object>, JsonOptions)
Handles the object graph using the specified writer
internal static void HandleObjectGraph(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
HandleObjectGraphCycle(TextWriter, object, JsonOptions)
Handles the object graph cycle using the specified writer
internal static void HandleObjectGraphCycle(TextWriter writer, object value, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
options
JsonOptions-
The options
HandleSpecialCases(TextWriter, object, IDictionary<object, object>, JsonOptions)
Describes whether handle special cases
internal static bool HandleSpecialCases(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleStreamValue(TextWriter, object, IDictionary<object, object>, JsonOptions)
Describes whether handle stream value
internal static bool HandleStreamValue(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleStringValue(Type, string, JsonOptions)
Handles the string value using the specified conversion type
internal static object HandleStringValue(Type conversionType, string value, JsonOptions options)
Parameters
conversionType
Type-
The conversion type
value
string-
The value
options
JsonOptions-
The options
Returns
- object
-
The object
HandleStringValue(TextWriter, object)
Describes whether handle string value
internal static bool HandleStringValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleTextProcessing(string, TextReader, JsonOptions)
Handles the text processing using the specified text
internal static object HandleTextProcessing(string text, TextReader reader, JsonOptions options)
Parameters
text
string-
The text
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- object
-
The object
HandleTimeSpan(object)
Handles the time span using the specified value
internal static object HandleTimeSpan(object value)
Parameters
value
object-
The value
Returns
- object
-
The value
HandleTimeSpanValue(TextWriter, object, JsonOptions)
Describes whether handle time span value
internal static bool HandleTimeSpanValue(TextWriter writer, object value, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
options
JsonOptions-
The options
Returns
- bool
-
The bool
HandleUriValue(TextWriter, object)
Describes whether handle uri value
internal static bool HandleUriValue(TextWriter writer, object value)
Parameters
writer
TextWriter-
The writer
value
object-
The value
Returns
- bool
-
The bool
HandleWriteValueCallback(JsonOptions, TextWriter, object, IDictionary<object, object>)
Handles the write value callback using the specified options
internal static void HandleWriteValueCallback(JsonOptions options, TextWriter writer, object value, IDictionary<object, object> objectGraph)
Parameters
options
JsonOptions-
The options
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
HandleWriterCases(TextWriter, Stream, IDictionary<object, object>, JsonOptions)
Handles the writer cases using the specified writer
internal static long HandleWriterCases(TextWriter writer, Stream stream, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
stream
Stream-
The stream
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- long
-
The total
HasScriptIgnore(PropertyDescriptor)
Describes whether has script ignore
internal static bool HasScriptIgnore(PropertyDescriptor pd)
Parameters
pd
PropertyDescriptor-
The pd
Returns
- bool
-
The bool
HasScriptIgnore(MemberInfo)
Checks if the member has a ScriptIgnore attribute
internal static bool HasScriptIgnore(MemberInfo member)
Parameters
member
MemberInfo-
The member to check
Returns
- bool
-
True if the member has a ScriptIgnore attribute, false otherwise
InitOptions(JsonOptions)
Inits the options using the specified options
internal static JsonOptions InitOptions(JsonOptions options)
Parameters
options
JsonOptions-
The options
Returns
- JsonOptions
-
The json options
InitializeListContext(ListObject, object, IEnumerable, JsonOptions)
Initializes the list context using the specified list
internal static void InitializeListContext(ListObject list, object target, IEnumerable input, JsonOptions options)
Parameters
list
ListObject-
The list
target
object-
The target
input
IEnumerable-
The input
options
JsonOptions-
The options
InitializeObjectGraph(IDictionary<object, object>, JsonOptions)
Initializes the object graph using the specified object graph
internal static IDictionary<object, object> InitializeObjectGraph(IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- IDictionary<object, object>
-
A dictionary of object and object
InitializeOptions(JsonOptions)
Initializes the options using the specified options
internal static JsonOptions InitializeOptions(JsonOptions options)
Parameters
options
JsonOptions-
The options
Returns
- JsonOptions
-
The json options
InitializeOptionsAndObjectGraph(JsonOptions, IDictionary<object, object>)
Initializes the options and object graph using the specified options
internal static void InitializeOptionsAndObjectGraph(JsonOptions options, IDictionary<object, object> objectGraph)
Parameters
options
JsonOptions-
The options
objectGraph
IDictionary<object, object>-
The object graph
InternalIsKeyValuePairEnumerable(Type, out Type, out Type)
Describes whether internal is key value pair enumerable
internal static bool InternalIsKeyValuePairEnumerable(Type type, out Type keyType, out Type valueType)
Parameters
Returns
- bool
-
The bool
InvertOffset(ref int, ref int)
Inverts the offset using the specified offset hours
internal static void InvertOffset(ref int offsetHours, ref int offsetMinutes)
Parameters
InvokeCallback(JsonOptions, JsonEventArgs)
Invokes the callback using the specified options
internal static void InvokeCallback(JsonOptions options, JsonEventArgs eventArgs)
Parameters
options
JsonOptions-
The options
eventArgs
JsonEventArgs-
The event args
InvokeConstructor(Type, SerializationInfo, JsonOptions)
Invokes the constructor using the specified type
internal static ISerializable InvokeConstructor(Type type, SerializationInfo info, JsonOptions options)
Parameters
type
Type-
The type
info
SerializationInfo-
The info
options
JsonOptions-
The options
Returns
- ISerializable
-
The serializable
Exceptions
- InvalidOperationException
-
No suitable constructor found for type {type.FullName}
InvokeConstructor(ConstructorInfo, SerializationInfo, StreamingContext)
Invokes the constructor using the specified constructor
internal static ISerializable InvokeConstructor(ConstructorInfo constructor, SerializationInfo info, StreamingContext context)
Parameters
constructor
ConstructorInfo-
The constructor
info
SerializationInfo-
The info
context
StreamingContext-
The context
Returns
- ISerializable
-
The serializable
InvokeCreateInstanceCallback(object, Type, int, JsonOptions, object)
Invokes the create instance callback using the specified target
internal static object InvokeCreateInstanceCallback(object target, Type type, int elementsCount, JsonOptions options, object value)
Parameters
target
object-
The target
type
Type-
The type
elementsCount
int-
The elements count
options
JsonOptions-
The options
value
object-
The value
Returns
- object
-
The object
IsByteArrayAsBase64(JsonOptions, Array)
Describes whether is byte array as base 64
internal static bool IsByteArrayAsBase64(JsonOptions options, Array array)
Parameters
options
JsonOptions-
The options
array
Array-
The array
Returns
- bool
-
The bool
IsCallbackAvailable(JsonOptions)
Describes whether is callback available
internal static bool IsCallbackAvailable(JsonOptions options)
Parameters
options
JsonOptions-
The options
Returns
- bool
-
The bool
IsDateTimeFormatValid(string)
Describes whether is date time format valid
internal static bool IsDateTimeFormatValid(string text)
Parameters
text
string-
The text
Returns
- bool
-
The bool
IsDictionaryNull(IDictionary<string, object>)
Describes whether is dictionary null
internal static bool IsDictionaryNull(IDictionary<string, object> dictionary)
Parameters
dictionary
IDictionary<string, object>-
The dictionary
Returns
- bool
-
The bool
IsElementDictionary(object)
Describes whether is element dictionary
internal static bool IsElementDictionary(object element)
Parameters
element
object-
The element
Returns
- bool
-
The bool
IsEscapeCharacter(char)
Describes whether is escape character
internal static bool IsEscapeCharacter(char c)
Parameters
c
char-
The
Returns
- bool
-
The bool
IsGenericEnumerable(Type, out Type, out Type)
Describes whether is generic enumerable
internal static bool IsGenericEnumerable(Type type, out Type keyType, out Type valueType)
Parameters
Returns
- bool
-
The bool
IsHexCharacter(char)
Describes whether is hex character
internal static bool IsHexCharacter(char c)
Parameters
c
char-
The
Returns
- bool
-
The bool
IsInvalidPathOrDictionary(string, IDictionary<string, object>)
Describes whether is invalid path or dictionary
internal static bool IsInvalidPathOrDictionary(string path, IDictionary<string, object> dictionary)
Parameters
path
string-
The path
dictionary
IDictionary<string, object>-
The dictionary
Returns
- bool
-
The bool
IsKeyValuePair(Type, out Type, out Type)
Describes whether is key value pair
internal static bool IsKeyValuePair(Type type, out Type keyType, out Type valueType)
Parameters
Returns
- bool
-
The bool
IsLiteral(string)
Describes whether is literal
internal static bool IsLiteral(string text)
Parameters
text
string-
The text
Returns
- bool
-
The bool
IsNegative(string, int)
Describes whether is negative
internal static bool IsNegative(string ticks, int pos)
Parameters
Returns
- bool
-
The bool
IsSpecialCharacter(char)
Describes whether is special character
internal static bool IsSpecialCharacter(char c)
Parameters
c
char-
The
Returns
- bool
-
The bool
IsTargetTypeNullOrObject(Type)
Describes whether is target type null or object
internal static bool IsTargetTypeNullOrObject(Type targetType)
Parameters
targetType
Type-
The target type
Returns
- bool
-
The bool
IsTextDateTime(string, out long)
Describes whether is text date time
internal static bool IsTextDateTime(string text, out long ticks)
Parameters
Returns
- bool
-
The bool
IsTextNull(string)
Describes whether is text null
internal static bool IsTextNull(string text)
Parameters
text
string-
The text
Returns
- bool
-
The bool
IsTimeSpanStyle(string)
Describes whether is time span style
internal static bool IsTimeSpanStyle(string text)
Parameters
text
string-
The text
Returns
- bool
-
The bool
IsUnicodeCharacter(char)
Describes whether is unicode character
internal static bool IsUnicodeCharacter(char c)
Parameters
c
char-
The
Returns
- bool
-
The bool
IsValidTarget(Array)
Describes whether is valid target
private static bool IsValidTarget(Array target)
Parameters
target
Array-
The target
Returns
- bool
-
The bool
IsValidTicks(string, out long)
Describes whether is valid ticks
internal static bool IsValidTicks(string ticks, out long l)
Parameters
Returns
- bool
-
The bool
IsZeroValueType(object)
Determines whether the specified value is a value type and is equal to zero.
public static bool IsZeroValueType(object value)
Parameters
value
object-
The value.
Returns
- bool
-
true if the specified value is a value type and is equal to zero; false otherwise.
NeedsEscaping(char)
Describes whether needs escaping
internal static bool NeedsEscaping(char c)
Parameters
c
char-
The
Returns
- bool
-
The bool
Nullify(string)
Nullifies the str
internal static string Nullify(this string str)
Parameters
str
string-
The str
Returns
- string
-
The string
ParseNumber(string, JsonOptions, TextReader)
Parses the number using the specified text
internal static object ParseNumber(string text, JsonOptions options, TextReader reader)
Parameters
text
string-
The text
options
JsonOptions-
The options
reader
TextReader-
The reader
Returns
- object
-
The object
PeekCharacter(TextReader, JsonOptions)
Peeks the character using the specified reader
internal static int PeekCharacter(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- int
-
The peeked char
PeekCharacter(TextReader)
Peeks the character using the specified reader
internal static char PeekCharacter(TextReader reader)
Parameters
reader
TextReader-
The reader
Returns
- char
-
The char
PrepareConstructorParameters(ConstructorInfo, object, int, JsonOptions, string)
Prepares the constructor parameters using the specified constructor
private static object[] PrepareConstructorParameters(ConstructorInfo constructor, object value, int elementsCount, JsonOptions options, string serializationTypeToken)
Parameters
constructor
ConstructorInfo-
The constructor
value
object-
The value
elementsCount
int-
The elements count
options
JsonOptions-
The options
serializationTypeToken
string-
The serialization type token
Returns
- object[]
-
The object array
PrepareOptions(JsonOptions)
Prepares the options using the specified options
internal static void PrepareOptions(JsonOptions options)
Parameters
options
JsonOptions-
The options
ProcessArrayInput(object, IEnumerable, Array, Type, JsonOptions)
Processes the array input using the specified target
internal static void ProcessArrayInput(object target, IEnumerable input, Array array, Type itemType, JsonOptions options)
Parameters
target
object-
The target
input
IEnumerable-
The input
array
Array-
The array
itemType
Type-
The item type
options
JsonOptions-
The options
ProcessCharacter(char, TextReader, JsonOptions, Dictionary<string, object>)
Processes the character using the specified c
internal static void ProcessCharacter(char c, TextReader reader, JsonOptions options, Dictionary<string, object> dictionary)
Parameters
c
char-
The
reader
TextReader-
The reader
options
JsonOptions-
The options
dictionary
Dictionary<string, object>-
The dictionary
ProcessCharacter(TextReader, StringBuilder, JsonOptions, char)
Processes the character using the specified reader
internal static void ProcessCharacter(TextReader reader, StringBuilder result, JsonOptions options, char currentChar)
Parameters
reader
TextReader-
The reader
result
StringBuilder-
The result
options
JsonOptions-
The options
currentChar
char-
The current char
ProcessDictionaryEntry(object, IDictionary, JsonOptions, TypeDef, DictionaryEntry)
Processes the dictionary entry using the specified target
internal static void ProcessDictionaryEntry(object target, IDictionary dictionary, JsonOptions options, TypeDef typeDefinition, DictionaryEntry entry)
Parameters
target
object-
The target
dictionary
IDictionary-
The dictionary
options
JsonOptions-
The options
typeDefinition
TypeDef-
The type definition
entry
DictionaryEntry-
The entry
ProcessInput(object, IEnumerable, ListObject, JsonOptions)
Processes the input using the specified target
internal static void ProcessInput(object target, IEnumerable input, ListObject list, JsonOptions options)
Parameters
target
object-
The target
input
IEnumerable-
The input
list
ListObject-
The list
options
JsonOptions-
The options
ProcessInputBasedOnCondition(object, IEnumerable, ListObject, JsonOptions)
Processes the input based on condition using the specified target
internal static void ProcessInputBasedOnCondition(object target, IEnumerable input, ListObject list, JsonOptions options)
Parameters
target
object-
The target
input
IEnumerable-
The input
list
ListObject-
The list
options
JsonOptions-
The options
ProcessListInput(object, IEnumerable, ListObject, Type, JsonOptions)
Processes the list input using the specified target
internal static void ProcessListInput(object target, IEnumerable input, ListObject list, Type itemType, JsonOptions options)
Parameters
target
object-
The target
input
IEnumerable-
The input
list
ListObject-
The list
itemType
Type-
The item type
options
JsonOptions-
The options
ProcessMapEntryCallback(JsonOptions, IDictionary, ref string, ref object, object)
Processes the map entry callback using the specified options
internal static void ProcessMapEntryCallback(JsonOptions options, IDictionary dictionary, ref string entryKey, ref object entryValue, object target)
Parameters
options
JsonOptions-
The options
dictionary
IDictionary-
The dictionary
entryKey
string-
The entry key
entryValue
object-
The entry value
target
object-
The target
ProcessSerializationOptions(Dictionary<string, object>, JsonOptions)
Processes the serialization options using the specified dic
internal static void ProcessSerializationOptions(Dictionary<string, object> dic, JsonOptions options)
Parameters
dic
Dictionary<string, object>-
The dic
options
JsonOptions-
The options
ProcessString(TextReader, JsonOptions, Dictionary<string, object>)
Processes the string using the specified reader
internal static void ProcessString(TextReader reader, JsonOptions options, Dictionary<string, object> dictionary)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
dictionary
Dictionary<string, object>-
The dictionary
ProcessTypeName(Dictionary<string, object>)
Processes the type name using the specified dictionary.
internal static void ProcessTypeName(Dictionary<string, object> dic)
Parameters
dic
Dictionary<string, object>-
The dictionary.
ReadArray(TextReader, JsonOptions)
Reads the array using the specified reader
internal static object[] ReadArray(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- object[]
-
The object array
ReadArrayValue(TextReader, JsonOptions)
Reads the array value using the specified reader
internal static object[] ReadArrayValue(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- object[]
-
The object array
ReadCharacters(TextReader, out bool)
Reads the characters using the specified reader
internal static string ReadCharacters(TextReader reader, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
arrayEnd
bool-
The array end
Returns
- string
-
The string
ReadDictionary(TextReader, JsonOptions)
Reads the dictionary using the specified reader
internal static Dictionary<string, object> ReadDictionary(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- Dictionary<string, object>
-
The dictionary
ReadDictionaryValue(TextReader, JsonOptions)
Reads the dictionary value using the specified reader
internal static Dictionary<string, object> ReadDictionaryValue(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- Dictionary<string, object>
-
The dic
ReadNew(TextReader, JsonOptions, out bool)
Reads the new using the specified reader
internal static object ReadNew(TextReader reader, JsonOptions options, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
arrayEnd
bool-
The array end
Returns
- object
-
The object
ReadNewValue(TextReader, JsonOptions, out bool)
Reads the new value using the specified reader
internal static object ReadNewValue(TextReader reader, JsonOptions options, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
arrayEnd
bool-
The array end
Returns
- object
-
The object
ReadNumberOrLiteral(TextReader, JsonOptions, out bool)
Reads the number or literal using the specified reader
internal static object ReadNumberOrLiteral(TextReader reader, JsonOptions options, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
arrayEnd
bool-
The array end
Returns
- object
-
The object
ReadNumberOrLiteralValue(TextReader, JsonOptions, out bool)
Reads the number or literal value using the specified reader
internal static object ReadNumberOrLiteralValue(TextReader reader, JsonOptions options, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
arrayEnd
bool-
The array end
Returns
- object
-
The object
ReadSerializable(TextReader, JsonOptions, string, Dictionary<string, object>)
Reads the serializable using the specified reader
internal static ISerializable ReadSerializable(TextReader reader, JsonOptions options, string typeName, Dictionary<string, object> values)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
typeName
string-
The type name
values
Dictionary<string, object>-
The values
Returns
- ISerializable
-
The serializable
ReadString(TextReader, JsonOptions)
Reads the string using the specified reader
internal static string ReadString(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- string
-
The string
ReadStringValue(TextReader, JsonOptions)
Reads the string value using the specified reader
internal static string ReadStringValue(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- string
-
The
ReadUntilEndCondition(TextReader, out bool)
Reads the until end condition using the specified reader
internal static string ReadUntilEndCondition(TextReader reader, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
arrayEnd
bool-
The array end
Returns
- string
-
The string
ReadValue(TextReader, JsonOptions)
Reads the value using the specified reader
internal static object ReadValue(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- object
-
The object
ReadValue(TextReader, JsonOptions, bool, out bool)
Reads the value using the specified reader
internal static object ReadValue(TextReader reader, JsonOptions options, bool arrayMode, out bool arrayEnd)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
arrayMode
bool-
The array mode
arrayEnd
bool-
The array end
Returns
- object
-
The object
ReadWhile(TextReader, Predicate<char>)
Describes whether read while
internal static bool ReadWhile(TextReader reader, Predicate<char> cont)
Parameters
reader
TextReader-
The reader
cont
Predicate<char>-
The cont
Returns
- bool
-
The bool
ReadWhitespaces(TextReader)
Describes whether read whitespaces
internal static bool ReadWhitespaces(TextReader reader)
Parameters
reader
TextReader-
The reader
Returns
- bool
-
The bool
ReadX4(TextReader, JsonOptions)
Reads the x 4 using the specified reader
internal static ushort ReadX4(TextReader reader, JsonOptions options)
Parameters
reader
TextReader-
The reader
options
JsonOptions-
The options
Returns
- ushort
-
The ushort
RemoveQuotesFromText(string)
Removes the quotes from text using the specified text
internal static string RemoveQuotesFromText(string text)
Parameters
text
string-
The text
Returns
- string
-
The text
Serialize(object, JsonOptions)
Serializes the specified object. Supports anonymous and dynamic types.
public static string Serialize(object value, JsonOptions options = null)
Parameters
value
object-
The object to serialize.
options
JsonOptions-
Options to use for serialization.
Returns
- string
-
A JSON representation of the serialized object.
Serialize(TextWriter, object, JsonOptions)
Serializes the specified object to the specified TextWriter. Supports anonymous and dynamic types.
internal static void Serialize(TextWriter writer, object value, JsonOptions options = null)
Parameters
writer
TextWriter-
The output writer. May not be null.
value
object-
The object to serialize.
options
JsonOptions-
Options to use for serialization.
SerializeFormatted(object, JsonOptions)
Serializes an object with format. Note this is more for debugging purposes as it's not designed to be fast.
public static string SerializeFormatted(object value, JsonOptions options = null)
Parameters
value
object-
The JSON object. May be null.
options
JsonOptions-
The options to use. May be null.
Returns
- string
-
A string containing the formatted object.
SerializeFormatted(TextWriter, object, JsonOptions)
Serializes an object with format. Note this is more for debugging purposes as it's not designed to be fast.
internal static void SerializeFormatted(TextWriter writer, object value, JsonOptions options = null)
Parameters
writer
TextWriter-
The output writer. May not be null.
value
object-
The JSON object. May be null.
options
JsonOptions-
The options to use. May be null.
SetOption(IDictionary<object, object>, JsonOptions)
Sets the option using the specified object graph
internal static JsonOptions SetOption(IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- JsonOptions
-
The options
SetOptions(object, JsonOptions)
Sets the options using the specified obj
internal static void SetOptions(object obj, JsonOptions options)
Parameters
obj
object-
The obj
options
JsonOptions-
The options
SetValuesInTarget(IEnumerable, Array, Type, JsonOptions)
Sets the values in target using the specified input
private static void SetValuesInTarget(IEnumerable input, Array target, Type elementType, JsonOptions options)
Parameters
input
IEnumerable-
The input
target
Array-
The target
elementType
Type-
The element type
options
JsonOptions-
The options
SkipWhitespace(TextReader)
Skips the whitespace using the specified reader
internal static void SkipWhitespace(TextReader reader)
Parameters
reader
TextReader-
The reader
TryCreateInstanceUsingSpecialConstructor(Type, object, int, JsonOptions, string)
Tries the create instance using special constructor using the specified type
private static object TryCreateInstanceUsingSpecialConstructor(Type type, object value, int elementsCount, JsonOptions options, string serializationTypeToken)
Parameters
type
Type-
The type
value
object-
The value
elementsCount
int-
The elements count
options
JsonOptions-
The options
serializationTypeToken
string-
The serialization type token
Returns
- object
-
The object
TryGetElement(IDictionary<string, object>, string, out object)
Describes whether try get element
internal static bool TryGetElement(IDictionary<string, object> dictionary, string key, out object element)
Parameters
dictionary
IDictionary<string, object>-
The dictionary
key
string-
The key
element
object-
The element
Returns
- bool
-
The bool
TryGetNestedValue(IDictionary<string, object>, string[], out object)
Describes whether try get nested value
internal static bool TryGetNestedValue(IDictionary<string, object> dictionary, string[] pathSegments, out object value)
Parameters
dictionary
IDictionary<string, object>-
The dictionary
pathSegments
string[]-
The path segments
value
object-
The value
Returns
- bool
-
The bool
TryGetObjectDefaultValue(Attribute, out object)
Describes whether try get object default value
internal static bool TryGetObjectDefaultValue(Attribute att, out object value)
Parameters
Returns
- bool
-
The bool
TryGetObjectDefaultValue(MemberInfo, out object)
Describes whether try get object default value
internal static bool TryGetObjectDefaultValue(MemberInfo mi, out object value)
Parameters
mi
MemberInfo-
The mi
value
object-
The value
Returns
- bool
-
The bool
TryGetObjectDefaultValue(PropertyDescriptor, out object)
Describes whether try get object default value
internal static bool TryGetObjectDefaultValue(PropertyDescriptor pd, out object value)
Parameters
pd
PropertyDescriptor-
The pd
value
object-
The value
Returns
- bool
-
The bool
TryGetValue(IDictionary<string, object>, string, out object)
Describes whether try get value
internal static bool TryGetValue(IDictionary<string, object> dictionary, string path, out object value)
Parameters
dictionary
IDictionary<string, object>-
The dictionary
path
string-
The path
value
object-
The value
Returns
- bool
-
The bool
TryGetValueByPath<T>(IDictionary<string, object>, string, out T)
Gets a value from a dictionary by its path. This is useful to get a value from the object that the untyped Deserialize method returns which is often of IDictionary<string, object> type.
public static bool TryGetValueByPath<T>(this IDictionary<string, object> dictionary, string path, out T value)
Parameters
dictionary
IDictionary<string, object>-
The input dictionary.
path
string-
The path, composed of dictionary keys separated by a . character. May not be null.
value
T-
The value to retrieve.
Returns
- bool
-
true if the value parameter was retrieved successfully; otherwise, false.
Type Parameters
T
-
The final type to which to convert the retrieved value.
TryGetValueByPath(IDictionary<string, object>, string, out object)
Describes whether try get value by path
internal static bool TryGetValueByPath(this IDictionary<string, object> dictionary, string path, out object value)
Parameters
dictionary
IDictionary<string, object>-
The dictionary
path
string-
The path
value
object-
The value
Returns
- bool
-
The bool
TryParseDateTime(string)
Converts the JSON string representation of a date time to its DateTime equivalent.
public static DateTime? TryParseDateTime(string text)
Parameters
text
string-
The input text.
Returns
- DateTime?
-
A DateTime value if the text was converted successfully; otherwise, null.
TryParseDateTime(string, DateTimeStyles)
Converts the JSON string representation of a date time to its DateTime equivalent.
public static DateTime? TryParseDateTime(string text, DateTimeStyles styles)
Parameters
text
string-
The input text.
styles
DateTimeStyles-
The styles to use.
Returns
- DateTime?
-
A DateTime value if the text was converted successfully; otherwise, null.
TryParseDateTime(string, out DateTime)
Converts the JSON string representation of a date time to its DateTime equivalent.
internal static bool TryParseDateTime(string text, out DateTime dt)
Parameters
Returns
- bool
-
true if the text was converted successfully; otherwise, false.
TryParseDateTime(string, DateTimeStyles, out DateTime)
Describes whether try parse date time
internal static bool TryParseDateTime(string text, DateTimeStyles styles, out DateTime dt)
Parameters
text
string-
The text
styles
DateTimeStyles-
The styles
dt
DateTime-
The dt
Returns
- bool
-
The bool
TryParseDateTimeWithEndZ(string, out DateTime)
Describes whether try parse date time with end z
internal static bool TryParseDateTimeWithEndZ(string text, out DateTime dt)
Parameters
Returns
- bool
-
The bool
TryParseDateTimeWithOffset(string, int, int, int, out DateTime)
Describes whether try parse date time with offset
internal static bool TryParseDateTimeWithOffset(string text, int tz, int offsetHours, int offsetMinutes, out DateTime dt)
Parameters
text
string-
The text
tz
int-
The tz
offsetHours
int-
The offset hours
offsetMinutes
int-
The offset minutes
dt
DateTime-
The dt
Returns
- bool
-
The bool
TryParseDateTimeWithSpecificFormat(string, out DateTime)
Tries to parse a date time with a specific format.
internal static bool TryParseDateTimeWithSpecificFormat(string text, out DateTime dt)
Parameters
Returns
- bool
-
True if parsing was successful, false otherwise.
TryParseDateTimeWithStandardFormat(string, DateTimeStyles, out DateTime)
Describes whether try parse date time with standard format
internal static bool TryParseDateTimeWithStandardFormat(string text, DateTimeStyles styles, out DateTime dt)
Parameters
text
string-
The text
styles
DateTimeStyles-
The styles
dt
DateTime-
The dt
Returns
- bool
-
The bool
TryParseDateTimeWithTicks(string, out DateTime)
Describes whether try parse date time with ticks
internal static bool TryParseDateTimeWithTicks(string text, out DateTime dt)
Parameters
Returns
- bool
-
The bool
TryParseExactDateTime(string, out DateTime)
Describes whether try parse exact date time
internal static bool TryParseExactDateTime(string text, out DateTime dt)
Parameters
Returns
- bool
-
The bool
TryParseOffset(string, out int)
Describes whether try parse offset
internal static bool TryParseOffset(string offsetString, out int offsetValue)
Parameters
Returns
- bool
-
The bool
TryParseTicks(string, int, int, out DateTime)
Describes whether try parse ticks
internal static bool TryParseTicks(string ticks, int offsetHours, int offsetMinutes, out DateTime dt)
Parameters
ticks
string-
The ticks
offsetHours
int-
The offset hours
offsetMinutes
int-
The offset minutes
dt
DateTime-
The dt
Returns
- bool
-
The bool
UpdateContext(ListObject, Type, object, object)
Updates the context using the specified list
internal static void UpdateContext(ListObject list, Type itemType, object value, object convertedValue)
Parameters
list
ListObject-
The list
itemType
Type-
The item type
value
object-
The value
convertedValue
object-
The converted value
UpdateContextIfNeeded(ListObject, Type, object, object)
Updates the context if needed using the specified list
internal static void UpdateContextIfNeeded(ListObject list, Type itemType, object value, object convertedValue)
Parameters
list
ListObject-
The list
itemType
Type-
The item type
value
object-
The value
convertedValue
object-
The converted value
UpdateValueBasedOnContext(ListObject, Type, object, object)
Updates the value based on context using the specified list.
internal static object UpdateValueBasedOnContext(ListObject list, Type itemType, object value, object convertedValue)
Parameters
list
ListObject-
The list.
itemType
Type-
The item type.
value
object-
The value.
convertedValue
object-
The converted value.
Returns
- object
-
The updated value.
ValidateReader(TextReader)
Validates the reader using the specified reader
internal static void ValidateReader(TextReader reader)
Parameters
reader
TextReader-
The reader
Exceptions
ValidateWriter(TextWriter)
Validates the writer using the specified writer
internal static void ValidateWriter(TextWriter writer)
Parameters
writer
TextWriter-
The writer
Exceptions
ValidateWriterAndArray(TextWriter, Array)
Validates the writer and array using the specified writer
internal static void ValidateWriterAndArray(TextWriter writer, Array array)
Parameters
writer
TextWriter-
The writer
array
Array-
The array
Exceptions
ValidateWriterAndDictionary(TextWriter, IDictionary)
Validates the writer and dictionary using the specified writer
internal static void ValidateWriterAndDictionary(TextWriter writer, IDictionary dictionary)
Parameters
writer
TextWriter-
The writer
dictionary
IDictionary-
The dictionary
Exceptions
ValidateWriterAndEnumerable(TextWriter, IEnumerable)
Validates the writer and enumerable using the specified writer
internal static void ValidateWriterAndEnumerable(TextWriter writer, IEnumerable enumerable)
Parameters
writer
TextWriter-
The writer
enumerable
IEnumerable-
The enumerable
Exceptions
ValidateWriterAndStream(TextWriter, Stream)
Validates the writer and stream using the specified writer
internal static void ValidateWriterAndStream(TextWriter writer, Stream stream)
Parameters
writer
TextWriter-
The writer
stream
Stream-
The stream
Exceptions
WriteArray(TextWriter, Array, IDictionary<object, object>, JsonOptions)
Writes the array using the specified writer
internal static void WriteArray(TextWriter writer, Array array, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The writer
array
Array-
The array
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteArray(TextWriter, Array, IDictionary<object, object>, JsonOptions, int[])
Writes the array using the specified writer
internal static void WriteArray(TextWriter writer, Array array, IDictionary<object, object> objectGraph, JsonOptions options, int[] indices)
Parameters
writer
TextWriter-
The writer
array
Array-
The array
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
indices
int[]-
The indices
WriteArrayElement(TextWriter, Array, IDictionary<object, object>, JsonOptions, int[])
Writes the array element using the specified writer
internal static void WriteArrayElement(TextWriter writer, Array array, IDictionary<object, object> objectGraph, JsonOptions options, int[] newIndices)
Parameters
writer
TextWriter-
The writer
array
Array-
The array
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
newIndices
int[]-
The new indices
WriteArrayElementSeparator(TextWriter, int)
Writes the array element separator using the specified writer
internal static void WriteArrayElementSeparator(TextWriter writer, int i)
Parameters
writer
TextWriter-
The writer
i
int-
The
WriteArrayElements(TextWriter, Array, IDictionary<object, object>, JsonOptions, int[], int[])
Writes the array elements using the specified writer
internal static void WriteArrayElements(TextWriter writer, Array array, IDictionary<object, object> objectGraph, JsonOptions options, int[] indices, int[] newIndices)
Parameters
writer
TextWriter-
The writer
array
Array-
The array
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
indices
int[]-
The indices
newIndices
int[]-
The new indices
WriteBase64Stream(TextWriter, Stream, IDictionary<object, object>, JsonOptions)
Writes the base 64 stream using the specified writer
internal static long WriteBase64Stream(TextWriter writer, Stream stream, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The writer
stream
Stream-
The stream
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Returns
- long
-
The total
WriteBase64Stream(Stream, Stream, JsonOptions)
Writes the base 64 stream using the specified input stream
internal static long WriteBase64Stream(Stream inputStream, Stream outputStream, JsonOptions options)
Parameters
inputStream
Stream-
The input stream
outputStream
Stream-
The output stream
options
JsonOptions-
The options
Returns
- long
-
The total
WriteBase64Stream(TextWriter, byte[], IDictionary<object, object>, JsonOptions)
Writes the base 64 stream using the specified writer
internal static void WriteBase64Stream(TextWriter writer, byte[] bytes, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
bytes
byte[]-
The bytes
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteCommaIfNeeded(TextWriter, ref bool)
Writes the comma if needed using the specified writer
internal static void WriteCommaIfNeeded(TextWriter writer, ref bool first)
Parameters
writer
TextWriter-
The writer
first
bool-
The first
WriteDictionary(TextWriter, IDictionary, IDictionary<object, object>, JsonOptions)
Writes the dictionary using the specified writer
internal static void WriteDictionary(TextWriter writer, IDictionary dictionary, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The writer
dictionary
IDictionary-
The dictionary
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteDictionary(IndentedTextWriter, IDictionary, JsonOptions)
Writes the dictionary using the specified writer
internal static void WriteDictionary(IndentedTextWriter writer, IDictionary dictionary, JsonOptions options)
Parameters
writer
IndentedTextWriter-
The writer
dictionary
IDictionary-
The dictionary
options
JsonOptions-
The options
WriteDictionaryEntries(TextWriter, IDictionary, IDictionary<object, object>, JsonOptions)
Writes the dictionary entries using the specified writer
internal static void WriteDictionaryEntries(TextWriter writer, IDictionary dictionary, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
dictionary
IDictionary-
The dictionary
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteDictionaryEntry(TextWriter, DictionaryEntry, ref bool, IDictionary<object, object>, JsonOptions)
Writes the dictionary entry using the specified writer
internal static void WriteDictionaryEntry(TextWriter writer, DictionaryEntry entry, ref bool first, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
entry
DictionaryEntry-
The entry
first
bool-
The first
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteDictionaryEntry(IndentedTextWriter, DictionaryEntry, JsonOptions)
Writes the dictionary entry using the specified writer
internal static void WriteDictionaryEntry(IndentedTextWriter writer, DictionaryEntry entry, JsonOptions options)
Parameters
writer
IndentedTextWriter-
The writer
entry
DictionaryEntry-
The entry
options
JsonOptions-
The options
WriteDictionaryKey(TextWriter, string, JsonOptions)
Writes the dictionary key using the specified writer
internal static void WriteDictionaryKey(TextWriter writer, string key, JsonOptions options)
Parameters
writer
TextWriter-
The writer
key
string-
The key
options
JsonOptions-
The options
WriteEntries(TextWriter, SerializationInfo, IDictionary<object, object>, JsonOptions)
Writes the entries using the specified writer
internal static void WriteEntries(TextWriter writer, SerializationInfo info, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
info
SerializationInfo-
The info
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteEntry(TextWriter, SerializationEntry, ref bool, IDictionary<object, object>, JsonOptions)
Writes the entry using the specified writer
internal static void WriteEntry(TextWriter writer, SerializationEntry entry, ref bool first, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
entry
SerializationEntry-
The entry
first
bool-
The first
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteEntryName(TextWriter, SerializationEntry, JsonOptions)
Writes the entry name using the specified writer
internal static void WriteEntryName(TextWriter writer, SerializationEntry entry, JsonOptions options)
Parameters
writer
TextWriter-
The writer
entry
SerializationEntry-
The entry
options
JsonOptions-
The options
WriteEnumerable(TextWriter, IEnumerable, IDictionary<object, object>, JsonOptions)
Writes the enumerable using the specified writer
internal static void WriteEnumerable(TextWriter writer, IEnumerable enumerable, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The writer
enumerable
IEnumerable-
The enumerable
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteEnumerable(IndentedTextWriter, IEnumerable, JsonOptions)
Writes the enumerable using the specified writer
internal static void WriteEnumerable(IndentedTextWriter writer, IEnumerable enumerable, JsonOptions options)
Parameters
writer
IndentedTextWriter-
The writer
enumerable
IEnumerable-
The enumerable
options
JsonOptions-
The options
WriteEnumerableValues(TextWriter, IEnumerable, IDictionary<object, object>, JsonOptions)
Writes the enumerable values using the specified writer
internal static void WriteEnumerableValues(TextWriter writer, IEnumerable enumerable, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
enumerable
IEnumerable-
The enumerable
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteEscapedString(TextWriter, string)
Writes the escaped string using the specified writer
internal static void WriteEscapedString(TextWriter writer, string text)
Parameters
writer
TextWriter-
The writer
text
string-
The text
WriteFormatted(object, JsonOptions)
Writes a JSON deserialized object formatted.
public static string WriteFormatted(object jsonObject, JsonOptions options = null)
Parameters
jsonObject
object-
The JSON object. May be null.
options
JsonOptions-
The options to use. May be null.
Returns
- string
-
A string containing the formatted object.
WriteFormatted(TextWriter, object, JsonOptions)
Writes a JSON deserialized object formatted.
internal static void WriteFormatted(TextWriter writer, object jsonObject, JsonOptions options = null)
Parameters
writer
TextWriter-
The output writer. May not be null.
jsonObject
object-
The JSON object. May be null.
options
JsonOptions-
The options to use. May be null.
WriteFormatted(IndentedTextWriter, object, JsonOptions)
Writes the formatted using the specified writer
internal static void WriteFormatted(IndentedTextWriter writer, object jsonObject, JsonOptions options)
Parameters
writer
IndentedTextWriter-
The writer
jsonObject
object-
The json object
options
JsonOptions-
The options
WriteJsonPEnd(TextWriter, JsonOptions)
Writes the json p end using the specified writer
internal static void WriteJsonPEnd(TextWriter writer, JsonOptions options)
Parameters
writer
TextWriter-
The writer
options
JsonOptions-
The options
WriteJsonPStart(TextWriter, JsonOptions)
Writes the json p start using the specified writer
internal static void WriteJsonPStart(TextWriter writer, JsonOptions options)
Parameters
writer
TextWriter-
The writer
options
JsonOptions-
The options
WriteNameValue(TextWriter, string, object, IDictionary<object, object>, JsonOptions)
Writes a name/value pair to a JSON writer.
public static void WriteNameValue(TextWriter writer, string name, object value, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The input writer. May not be null.
name
string-
The name. null values will be converted to empty values.
value
object-
The value.
objectGraph
IDictionary<object, object>-
The object graph.
options
JsonOptions-
The options to use.
WriteObject(TextWriter, object, IDictionary<object, object>, JsonOptions)
Writes the object using the specified writer
internal static void WriteObject(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteSerializable(TextWriter, ISerializable, IDictionary<object, object>, JsonOptions)
Writes the serializable using the specified writer
internal static void WriteSerializable(TextWriter writer, ISerializable serializable, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
serializable
ISerializable-
The serializable
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
WriteSerializableOrValues(TextWriter, object, IDictionary<object, object>, JsonOptions)
Writes the serializable or values using the specified writer.
internal static void WriteSerializableOrValues(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer.
value
object-
The value.
objectGraph
IDictionary<object, object>-
The object graph.
options
JsonOptions-
The options.
WriteStreamToWriter(TextWriter, Stream, JsonOptions, ref long)
Writes the stream to writer using the specified writer
internal static void WriteStreamToWriter(TextWriter writer, Stream stream, JsonOptions options, ref long total)
Parameters
writer
TextWriter-
The writer
stream
Stream-
The stream
options
JsonOptions-
The options
total
long-
The total
WriteString(TextWriter, string)
Writes a string to a JSON writer.
internal static void WriteString(TextWriter writer, string text)
Parameters
writer
TextWriter-
The input writer. May not be null.
text
string-
The text.
WriteText(TextWriter, string)
Writes the text using the specified writer
internal static void WriteText(TextWriter writer, string text)
Parameters
writer
TextWriter-
The writer
text
string-
The text
WriteUnescapedString(TextWriter, string)
Writes a string to a JSON writer.
internal static void WriteUnescapedString(TextWriter writer, string text)
Parameters
writer
TextWriter-
The input writer. May not be null.
text
string-
The text.
WriteValue(TextWriter, object, IDictionary<object, object>, JsonOptions)
Writes the value using the specified writer
public static void WriteValue(TextWriter writer, object value, IDictionary<object, object> objectGraph, JsonOptions options = null)
Parameters
writer
TextWriter-
The writer
value
object-
The value
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options
Exceptions
WriteValueWithSeparator(TextWriter, object, ref bool, IDictionary<object, object>, JsonOptions)
Writes the value with separator using the specified writer
internal static void WriteValueWithSeparator(TextWriter writer, object value, ref bool first, IDictionary<object, object> objectGraph, JsonOptions options)
Parameters
writer
TextWriter-
The writer
value
object-
The value
first
bool-
The first
objectGraph
IDictionary<object, object>-
The object graph
options
JsonOptions-
The options