Class JsonSerializer
- Namespace
- Alis.Core.Aspect.Data.Json
- Assembly
- Alis.dll
A utility class to serialize and deserialize JSON.
public static class JsonSerializerInheritance
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[] DateFormatsUtcField 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 DefaultFormatterConverterField 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 MinDateTimeField Value
MinDateTimeTicks
The ticks
internal static readonly long MinDateTimeTicksField 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
valuefloat-
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
sbStringBuilder-
The sb
cchar-
The
AppendDefaultCharacter(StringBuilder, char)
Appends the default character using the specified result
internal static void AppendDefaultCharacter(StringBuilder result, char c)Parameters
resultStringBuilder-
The result
cchar-
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
resultStringBuilder-
The result
nextCharchar-
The next char
readerTextReader-
The reader
optionsJsonOptions-
The options
AppendSpecialCharacter(StringBuilder, char)
Appends the special character using the specified result
internal static void AppendSpecialCharacter(StringBuilder result, char c)Parameters
resultStringBuilder-
The result
cchar-
The
AppendTimeZoneUtcOffset(TextWriter, DateTime)
Appends the time zone utc offset using the specified writer
internal static void AppendTimeZoneUtcOffset(TextWriter writer, DateTime dt)Parameters
writerTextWriter-
The writer
dtDateTime-
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
resultStringBuilder-
The result
readerTextReader-
The reader
optionsJsonOptions-
The options
Apply(object, object, JsonOptions)
Applies the input
internal static void Apply(object input, object target, JsonOptions options = null)Parameters
inputobject-
The input
targetobject-
The target
optionsJsonOptions-
The options
Apply(IEnumerable, Array, JsonOptions)
Applies the input
internal static void Apply(IEnumerable input, Array target, JsonOptions options)Parameters
inputIEnumerable-
The input
targetArray-
The target
optionsJsonOptions-
The options
Apply(IDictionary, object, JsonOptions)
Applies the dictionary
internal static void Apply(IDictionary dictionary, object target, JsonOptions options)Parameters
dictionaryIDictionary-
The dictionary
targetobject-
The target
optionsJsonOptions-
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
inputobject-
The input
arrayArray-
The array
optionsJsonOptions-
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
dicIDictionary-
The dic
targetobject-
The target
optionsJsonOptions-
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
targetDictionaryIDictionary-
The target dictionary to which values are applied
sourceDictionaryIDictionary-
The source dictionary from which values are taken
optionsJsonOptions-
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
inputobject-
The input
targetobject-
The target
optionsJsonOptions-
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
inputIEnumerable-
The input
targetobject-
The target
optionsJsonOptions-
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
targetobject-
The target
inputIEnumerable-
The input
listListObject-
The list
optionsJsonOptions-
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
targetobject-
The target
dictionaryIDictionary-
The dictionary
optionsJsonOptions-
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
inputIEnumerable-
The input
targetArray-
The target
optionsJsonOptions-
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
inputIDictionary-
The input
targetobject-
The target
optionsJsonOptions-
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
offsetValueint-
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
textstring-
The text
tzint-
The tz
offsetHoursint-
The offset hours
offsetMinutesint-
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
ticksstring-
The ticks
posint-
The pos
updatedTicksstring-
The updated ticks
offsetHoursint-
The offset hours
offsetMinutesint-
The offset minutes
CanReadCharacter(TextReader)
Describes whether can read character
internal static bool CanReadCharacter(TextReader reader)Parameters
readerTextReader-
The reader
Returns
- bool
-
The bool
CanUseSpecialConstructor(Type)
Describes whether can use special constructor
private static bool CanUseSpecialConstructor(Type type)Parameters
typeType-
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
valueobject-
The input object. May be null.
conversionTypeType-
The target type. May not be null.
optionsJsonOptions-
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
targetobject-
The target
valueobject-
The value
conversionTypeType-
The conversion type
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
Exceptions
ClearContextIfNotNull(ListObject)
Clears the context if not null using the specified list
internal static void ClearContextIfNotNull(ListObject list)Parameters
listListObject-
The list
ClearList(ListObject)
Clears the list using the specified list
internal static void ClearList(ListObject list)Parameters
listListObject-
The list
ConvertHexCharacterToByte(char)
Converts the hex character to byte using the specified c
internal static byte ConvertHexCharacterToByte(char c)Parameters
cchar-
The
Returns
- byte
-
The byte
ConvertTicksToDateTime(long)
Converts the ticks to date time using the specified ticks
internal static DateTime ConvertTicksToDateTime(long ticks)Parameters
tickslong-
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
valueobject-
The value
targetTypeType-
The target type
optionsJsonOptions-
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
typeType-
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
targetobject-
The target
typeType-
The type
elementsCountint-
The elements count
optionsJsonOptions-
The options
valueobject-
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
typeType-
The type
targetobject-
The target
elementsCountint-
The elements count
optionsJsonOptions-
The options
valueobject-
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
typeType-
The type
targetobject-
The target
elementsCountint-
The elements count
optionsJsonOptions-
The options
valueobject-
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
typeType-
The type
valueobject-
The value
elementsCountint-
The elements count
optionsJsonOptions-
The options
serializationTypeTokenstring-
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
typeType-
The type
dictionaryIDictionary-
The dictionary
valueobject-
The value
optionsJsonOptions-
The options
keystring-
The key
targetobject-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
typeType-
The type
Returns
- ListObject
-
The list object
CreateNewIndices(int[])
Creates the new indices using the specified indices
internal static int[] CreateNewIndices(int[] indices)Parameters
indicesint[]-
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
typeType-
The type
valuesDictionary<string, object>-
The values
optionsJsonOptions-
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
typeType-
The type
valuesDictionary<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
textstring-
The text text.
targetTypeType-
The required target type.
optionsJsonOptions-
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
readerTextReader-
The input reader. May not be null.
optionsJsonOptions-
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
textstring-
The text to deserialize.
optionsJsonOptions-
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
readerTextReader-
The reader
targetTypeType-
The target type
optionsJsonOptions-
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
textstring-
The text to deserialize.
targetobject-
The object instance to populate.
optionsJsonOptions-
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
readerTextReader-
The input reader. May not be null.
targetobject-
The object instance to populate.
optionsJsonOptions-
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
sourcestring-
The source string.
targetstring-
The target string to compare with the source string.
trimbool-
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
valuestring-
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
ticksstring-
The ticks
updatedTicksstring-
The updated ticks
offsetHoursint-
The offset hours
offsetMinutesint-
The offset minutes
ExtractTicks(string)
Extracts the ticks using the specified text
internal static string ExtractTicks(string text)Parameters
textstring-
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
parameterParameterInfo-
The parameter
dictionaryIDictionary-
The dictionary
elementsCountint-
The elements count
optionsJsonOptions-
The options
serializationTypeTokenstring-
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
typeType-
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
textstring-
The text
Returns
- int
-
The int
ForceSerializable(object)
Describes whether force serializable
internal static bool ForceSerializable(object obj)Parameters
objobject-
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
dicDictionary<string, object>-
The dictionary.
oobject-
The object containing the type name.
FormatTypeName(object)
Formats the type name using the specified o
internal static string FormatTypeName(object o)Parameters
oobject-
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 : AttributeParameters
descriptorPropertyDescriptor-
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 : AttributeParameters
attributesAttributeCollection-
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
typeType-
The type
Returns
- ConstructorInfo
-
The constructor info
GetEofException(char)
Gets the eof exception using the specified c
internal static JsonException GetEofException(char c)Parameters
cchar-
The
Returns
- JsonException
-
The json exception
GetEscapedString(char)
Gets the escaped string using the specified c
internal static string GetEscapedString(char c)Parameters
cchar-
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
poslong-
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
readerTextReader-
The reader
cchar-
The character to convert
optionsJsonOptions-
The options
Returns
- byte
-
The byte
GetItemType(Type)
Gets the type of elements in a collection type.
internal static Type GetItemType(Type collectionType)Parameters
collectionTypeType-
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
piMemberInfo-
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
piMemberInfo-
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
typeType-
The type
optionsJsonOptions-
The options
targetobject-
The target
valueobject-
The value
dictionaryIDictionary-
The dictionary
keystring-
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
dictionaryIDictionary<string, object>-
The input dictionary.
pathstring-
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
attAttribute-
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
memberInfoMemberInfo-
The member info
defaultNamestring-
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
pdPropertyDescriptor-
The pd
defaultNamestring-
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
readerTextReader-
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
readerTextReader-
The reader
Returns
- long
-
The long
GetSerializationInfo(ISerializable)
Gets the serialization info using the specified serializable
internal static SerializationInfo GetSerializationInfo(ISerializable serializable)Parameters
serializableISerializable-
The serializable
Returns
- SerializationInfo
-
The info
GetStartIndex(string)
Gets the start index using the specified ticks
internal static int GetStartIndex(string ticks)Parameters
ticksstring-
The ticks
Returns
- int
-
The int
GetStreamReaderPosition(StreamReader)
Gets the stream reader position using the specified sr
internal static long GetStreamReaderPosition(StreamReader sr)Parameters
srStreamReader-
The sr
Returns
- long
-
The long
GetStringReaderPosition(StringReader)
Gets the string reader position using the specified str
internal static long GetStringReaderPosition(StringReader str)Parameters
strStringReader-
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
readerTextReader-
The reader
typeNamestring-
The type name
optionsJsonOptions-
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
typeNamestring-
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
listListObject-
The list
defaultValueobject-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
targetobject-
The target
enIEnumerable-
The en
conversionTypeType-
The conversion type
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
HandleBoolValue(TextWriter, object)
Describes whether handle bool value
internal static bool HandleBoolValue(TextWriter writer, object value)Parameters
writerTextWriter-
The writer
valueobject-
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
base64Stringstring-
The base64 string.
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
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
typeType-
The type
eException-
The
optionsJsonOptions-
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
valueobject-
The value
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
optionsJsonOptions-
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
textstring-
The text
readerTextReader-
The reader
optionsJsonOptions-
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
targetobject-
The target
conversionTypeType-
The conversion type
dicIDictionary-
The dic
optionsJsonOptions-
The options
Returns
- object
-
The instance
HandleDotCase(string)
Handles the dot case using the specified text
internal static object HandleDotCase(string text)Parameters
textstring-
The text
Returns
- object
-
The object
HandleECase(string)
Handles the e case using the specified text
internal static object HandleECase(string text)Parameters
textstring-
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
writerTextWriter-
The writer
valueobject-
The value
optionsJsonOptions-
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
readerTextReader-
The reader
resultStringBuilder-
The result
optionsJsonOptions-
The options
HandleException(Exception, JsonOptions)
Handles the exception using the specified ex
internal static void HandleException(Exception ex, JsonOptions options)Parameters
exException-
The ex
optionsJsonOptions-
The options
HandleFloatDoubleValue(TextWriter, object)
Describes whether handle float double value
internal static bool HandleFloatDoubleValue(TextWriter writer, object value)Parameters
writerTextWriter-
The writer
valueobject-
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
writerTextWriter-
The writer
valueobject-
The value
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
inputIEnumerable-
The input
targetArray-
The target
elementTypeType-
The element type
optionsJsonOptions-
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
targetobject-
The target
enIEnumerable-
The en
loListObject-
The lo
conversionTypeType-
The conversion type
valueobject-
The value
optionsJsonOptions-
The options
Returns
- object
-
The object
HandleLiteral(string)
Handles the literal using the specified text
internal static object HandleLiteral(string text)Parameters
textstring-
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
targetobject-
The target
valueobject-
The value
conversionTypeType-
The conversion type
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
Returns
- bool
-
The bool
HandleNumericValue(TextWriter, object)
Describes whether handle numeric value
internal static bool HandleNumericValue(TextWriter writer, object value)Parameters
writerTextWriter-
The writer
valueobject-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
conversionTypeType-
The conversion type
valuestring-
The value
optionsJsonOptions-
The options
Returns
- object
-
The object
HandleStringValue(TextWriter, object)
Describes whether handle string value
internal static bool HandleStringValue(TextWriter writer, object value)Parameters
writerTextWriter-
The writer
valueobject-
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
textstring-
The text
readerTextReader-
The reader
optionsJsonOptions-
The options
Returns
- object
-
The object
HandleTimeSpan(object)
Handles the time span using the specified value
internal static object HandleTimeSpan(object value)Parameters
valueobject-
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
writerTextWriter-
The writer
valueobject-
The value
optionsJsonOptions-
The options
Returns
- bool
-
The bool
HandleUriValue(TextWriter, object)
Describes whether handle uri value
internal static bool HandleUriValue(TextWriter writer, object value)Parameters
writerTextWriter-
The writer
valueobject-
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
optionsJsonOptions-
The options
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<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
writerTextWriter-
The writer
streamStream-
The stream
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
Returns
- long
-
The total
HasScriptIgnore(PropertyDescriptor)
Describes whether has script ignore
internal static bool HasScriptIgnore(PropertyDescriptor pd)Parameters
pdPropertyDescriptor-
The pd
Returns
- bool
-
The bool
HasScriptIgnore(MemberInfo)
Checks if the member has a ScriptIgnore attribute
internal static bool HasScriptIgnore(MemberInfo member)Parameters
memberMemberInfo-
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
optionsJsonOptions-
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
listListObject-
The list
targetobject-
The target
inputIEnumerable-
The input
optionsJsonOptions-
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
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
optionsJsonOptions-
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
optionsJsonOptions-
The options
objectGraphIDictionary<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
optionsJsonOptions-
The options
eventArgsJsonEventArgs-
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
typeType-
The type
infoSerializationInfo-
The info
optionsJsonOptions-
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
constructorConstructorInfo-
The constructor
infoSerializationInfo-
The info
contextStreamingContext-
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
targetobject-
The target
typeType-
The type
elementsCountint-
The elements count
optionsJsonOptions-
The options
valueobject-
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
optionsJsonOptions-
The options
arrayArray-
The array
Returns
- bool
-
The bool
IsCallbackAvailable(JsonOptions)
Describes whether is callback available
internal static bool IsCallbackAvailable(JsonOptions options)Parameters
optionsJsonOptions-
The options
Returns
- bool
-
The bool
IsDateTimeFormatValid(string)
Describes whether is date time format valid
internal static bool IsDateTimeFormatValid(string text)Parameters
textstring-
The text
Returns
- bool
-
The bool
IsDictionaryNull(IDictionary<string, object>)
Describes whether is dictionary null
internal static bool IsDictionaryNull(IDictionary<string, object> dictionary)Parameters
dictionaryIDictionary<string, object>-
The dictionary
Returns
- bool
-
The bool
IsElementDictionary(object)
Describes whether is element dictionary
internal static bool IsElementDictionary(object element)Parameters
elementobject-
The element
Returns
- bool
-
The bool
IsEscapeCharacter(char)
Describes whether is escape character
internal static bool IsEscapeCharacter(char c)Parameters
cchar-
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
cchar-
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
pathstring-
The path
dictionaryIDictionary<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
textstring-
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
cchar-
The
Returns
- bool
-
The bool
IsTargetTypeNullOrObject(Type)
Describes whether is target type null or object
internal static bool IsTargetTypeNullOrObject(Type targetType)Parameters
targetTypeType-
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
textstring-
The text
Returns
- bool
-
The bool
IsTimeSpanStyle(string)
Describes whether is time span style
internal static bool IsTimeSpanStyle(string text)Parameters
textstring-
The text
Returns
- bool
-
The bool
IsUnicodeCharacter(char)
Describes whether is unicode character
internal static bool IsUnicodeCharacter(char c)Parameters
cchar-
The
Returns
- bool
-
The bool
IsValidTarget(Array)
Describes whether is valid target
private static bool IsValidTarget(Array target)Parameters
targetArray-
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
valueobject-
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
cchar-
The
Returns
- bool
-
The bool
Nullify(string)
Nullifies the str
internal static string Nullify(this string str)Parameters
strstring-
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
textstring-
The text
optionsJsonOptions-
The options
readerTextReader-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
Returns
- int
-
The peeked char
PeekCharacter(TextReader)
Peeks the character using the specified reader
internal static char PeekCharacter(TextReader reader)Parameters
readerTextReader-
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
constructorConstructorInfo-
The constructor
valueobject-
The value
elementsCountint-
The elements count
optionsJsonOptions-
The options
serializationTypeTokenstring-
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
optionsJsonOptions-
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
targetobject-
The target
inputIEnumerable-
The input
arrayArray-
The array
itemTypeType-
The item type
optionsJsonOptions-
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
cchar-
The
readerTextReader-
The reader
optionsJsonOptions-
The options
dictionaryDictionary<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
readerTextReader-
The reader
resultStringBuilder-
The result
optionsJsonOptions-
The options
currentCharchar-
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
targetobject-
The target
dictionaryIDictionary-
The dictionary
optionsJsonOptions-
The options
typeDefinitionTypeDef-
The type definition
entryDictionaryEntry-
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
targetobject-
The target
inputIEnumerable-
The input
listListObject-
The list
optionsJsonOptions-
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
targetobject-
The target
inputIEnumerable-
The input
listListObject-
The list
optionsJsonOptions-
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
targetobject-
The target
inputIEnumerable-
The input
listListObject-
The list
itemTypeType-
The item type
optionsJsonOptions-
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
optionsJsonOptions-
The options
dictionaryIDictionary-
The dictionary
entryKeystring-
The entry key
entryValueobject-
The entry value
targetobject-
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
dicDictionary<string, object>-
The dic
optionsJsonOptions-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
dictionaryDictionary<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
dicDictionary<string, object>-
The dictionary.
ReadArray(TextReader, JsonOptions)
Reads the array using the specified reader
internal static object[] ReadArray(TextReader reader, JsonOptions options)Parameters
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
arrayEndbool-
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
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
arrayEndbool-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
arrayEndbool-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
arrayEndbool-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
arrayEndbool-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
typeNamestring-
The type name
valuesDictionary<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
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
arrayEndbool-
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
readerTextReader-
The reader
optionsJsonOptions-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
arrayModebool-
The array mode
arrayEndbool-
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
readerTextReader-
The reader
contPredicate<char>-
The cont
Returns
- bool
-
The bool
ReadWhitespaces(TextReader)
Describes whether read whitespaces
internal static bool ReadWhitespaces(TextReader reader)Parameters
readerTextReader-
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
readerTextReader-
The reader
optionsJsonOptions-
The options
Returns
- ushort
-
The ushort
RemoveQuotesFromText(string)
Removes the quotes from text using the specified text
internal static string RemoveQuotesFromText(string text)Parameters
textstring-
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
valueobject-
The object to serialize.
optionsJsonOptions-
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
writerTextWriter-
The output writer. May not be null.
valueobject-
The object to serialize.
optionsJsonOptions-
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
valueobject-
The JSON object. May be null.
optionsJsonOptions-
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
writerTextWriter-
The output writer. May not be null.
valueobject-
The JSON object. May be null.
optionsJsonOptions-
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
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
objobject-
The obj
optionsJsonOptions-
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
inputIEnumerable-
The input
targetArray-
The target
elementTypeType-
The element type
optionsJsonOptions-
The options
SkipWhitespace(TextReader)
Skips the whitespace using the specified reader
internal static void SkipWhitespace(TextReader reader)Parameters
readerTextReader-
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
typeType-
The type
valueobject-
The value
elementsCountint-
The elements count
optionsJsonOptions-
The options
serializationTypeTokenstring-
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
dictionaryIDictionary<string, object>-
The dictionary
keystring-
The key
elementobject-
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
dictionaryIDictionary<string, object>-
The dictionary
pathSegmentsstring[]-
The path segments
valueobject-
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
miMemberInfo-
The mi
valueobject-
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
pdPropertyDescriptor-
The pd
valueobject-
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
dictionaryIDictionary<string, object>-
The dictionary
pathstring-
The path
valueobject-
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
dictionaryIDictionary<string, object>-
The input dictionary.
pathstring-
The path, composed of dictionary keys separated by a . character. May not be null.
valueT-
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
dictionaryIDictionary<string, object>-
The dictionary
pathstring-
The path
valueobject-
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
textstring-
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
textstring-
The input text.
stylesDateTimeStyles-
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
textstring-
The text
stylesDateTimeStyles-
The styles
dtDateTime-
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
textstring-
The text
tzint-
The tz
offsetHoursint-
The offset hours
offsetMinutesint-
The offset minutes
dtDateTime-
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
textstring-
The text
stylesDateTimeStyles-
The styles
dtDateTime-
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
ticksstring-
The ticks
offsetHoursint-
The offset hours
offsetMinutesint-
The offset minutes
dtDateTime-
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
listListObject-
The list
itemTypeType-
The item type
valueobject-
The value
convertedValueobject-
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
listListObject-
The list
itemTypeType-
The item type
valueobject-
The value
convertedValueobject-
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
listListObject-
The list.
itemTypeType-
The item type.
valueobject-
The value.
convertedValueobject-
The converted value.
Returns
- object
-
The updated value.
ValidateReader(TextReader)
Validates the reader using the specified reader
internal static void ValidateReader(TextReader reader)Parameters
readerTextReader-
The reader
Exceptions
ValidateWriter(TextWriter)
Validates the writer using the specified writer
internal static void ValidateWriter(TextWriter writer)Parameters
writerTextWriter-
The writer
Exceptions
ValidateWriterAndArray(TextWriter, Array)
Validates the writer and array using the specified writer
internal static void ValidateWriterAndArray(TextWriter writer, Array array)Parameters
writerTextWriter-
The writer
arrayArray-
The array
Exceptions
ValidateWriterAndDictionary(TextWriter, IDictionary)
Validates the writer and dictionary using the specified writer
internal static void ValidateWriterAndDictionary(TextWriter writer, IDictionary dictionary)Parameters
writerTextWriter-
The writer
dictionaryIDictionary-
The dictionary
Exceptions
ValidateWriterAndEnumerable(TextWriter, IEnumerable)
Validates the writer and enumerable using the specified writer
internal static void ValidateWriterAndEnumerable(TextWriter writer, IEnumerable enumerable)Parameters
writerTextWriter-
The writer
enumerableIEnumerable-
The enumerable
Exceptions
ValidateWriterAndStream(TextWriter, Stream)
Validates the writer and stream using the specified writer
internal static void ValidateWriterAndStream(TextWriter writer, Stream stream)Parameters
writerTextWriter-
The writer
streamStream-
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
writerTextWriter-
The writer
arrayArray-
The array
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
arrayArray-
The array
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
indicesint[]-
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
writerTextWriter-
The writer
arrayArray-
The array
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
newIndicesint[]-
The new indices
WriteArrayElementSeparator(TextWriter, int)
Writes the array element separator using the specified writer
internal static void WriteArrayElementSeparator(TextWriter writer, int i)Parameters
writerTextWriter-
The writer
iint-
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
writerTextWriter-
The writer
arrayArray-
The array
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
indicesint[]-
The indices
newIndicesint[]-
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
writerTextWriter-
The writer
streamStream-
The stream
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
inputStreamStream-
The input stream
outputStreamStream-
The output stream
optionsJsonOptions-
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
writerTextWriter-
The writer
bytesbyte[]-
The bytes
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
firstbool-
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
writerTextWriter-
The writer
dictionaryIDictionary-
The dictionary
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
WriteDictionary(IndentedTextWriter, IDictionary, JsonOptions)
Writes the dictionary using the specified writer
internal static void WriteDictionary(IndentedTextWriter writer, IDictionary dictionary, JsonOptions options)Parameters
writerIndentedTextWriter-
The writer
dictionaryIDictionary-
The dictionary
optionsJsonOptions-
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
writerTextWriter-
The writer
dictionaryIDictionary-
The dictionary
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
entryDictionaryEntry-
The entry
firstbool-
The first
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerIndentedTextWriter-
The writer
entryDictionaryEntry-
The entry
optionsJsonOptions-
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
writerTextWriter-
The writer
keystring-
The key
optionsJsonOptions-
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
writerTextWriter-
The writer
infoSerializationInfo-
The info
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
entrySerializationEntry-
The entry
firstbool-
The first
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
entrySerializationEntry-
The entry
optionsJsonOptions-
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
writerTextWriter-
The writer
enumerableIEnumerable-
The enumerable
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
WriteEnumerable(IndentedTextWriter, IEnumerable, JsonOptions)
Writes the enumerable using the specified writer
internal static void WriteEnumerable(IndentedTextWriter writer, IEnumerable enumerable, JsonOptions options)Parameters
writerIndentedTextWriter-
The writer
enumerableIEnumerable-
The enumerable
optionsJsonOptions-
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
writerTextWriter-
The writer
enumerableIEnumerable-
The enumerable
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options
WriteEscapedString(TextWriter, string)
Writes the escaped string using the specified writer
internal static void WriteEscapedString(TextWriter writer, string text)Parameters
writerTextWriter-
The writer
textstring-
The text
WriteFormatted(object, JsonOptions)
Writes a JSON deserialized object formatted.
public static string WriteFormatted(object jsonObject, JsonOptions options = null)Parameters
jsonObjectobject-
The JSON object. May be null.
optionsJsonOptions-
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
writerTextWriter-
The output writer. May not be null.
jsonObjectobject-
The JSON object. May be null.
optionsJsonOptions-
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
writerIndentedTextWriter-
The writer
jsonObjectobject-
The json object
optionsJsonOptions-
The options
WriteJsonPEnd(TextWriter, JsonOptions)
Writes the json p end using the specified writer
internal static void WriteJsonPEnd(TextWriter writer, JsonOptions options)Parameters
writerTextWriter-
The writer
optionsJsonOptions-
The options
WriteJsonPStart(TextWriter, JsonOptions)
Writes the json p start using the specified writer
internal static void WriteJsonPStart(TextWriter writer, JsonOptions options)Parameters
writerTextWriter-
The writer
optionsJsonOptions-
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
writerTextWriter-
The input writer. May not be null.
namestring-
The name. null values will be converted to empty values.
valueobject-
The value.
objectGraphIDictionary<object, object>-
The object graph.
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
serializableISerializable-
The serializable
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer.
valueobject-
The value.
objectGraphIDictionary<object, object>-
The object graph.
optionsJsonOptions-
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
writerTextWriter-
The writer
streamStream-
The stream
optionsJsonOptions-
The options
totallong-
The total
WriteString(TextWriter, string)
Writes a string to a JSON writer.
internal static void WriteString(TextWriter writer, string text)Parameters
writerTextWriter-
The input writer. May not be null.
textstring-
The text.
WriteText(TextWriter, string)
Writes the text using the specified writer
internal static void WriteText(TextWriter writer, string text)Parameters
writerTextWriter-
The writer
textstring-
The text
WriteUnescapedString(TextWriter, string)
Writes a string to a JSON writer.
internal static void WriteUnescapedString(TextWriter writer, string text)Parameters
writerTextWriter-
The input writer. May not be null.
textstring-
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
writerTextWriter-
The writer
valueobject-
The value
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
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
writerTextWriter-
The writer
valueobject-
The value
firstbool-
The first
objectGraphIDictionary<object, object>-
The object graph
optionsJsonOptions-
The options