• Manual
  • API Documentation
  • Bayat.Json
  • JsonSerializer

    Show / Hide Table of Contents
    • Bayat
      • UnityThread
    • Bayat.Core
      • AddReferenceWindow
      • AddReferenceWindow.Dependency
      • AssetReferenceResolver
      • AssetReferenceResolverEditor
      • BayatEditorStyles
      • CoreAssetPostProcessor
      • EditorApplicationUtility
      • MaterialPropertiesResolver
      • MaterialPropertiesResolverEditor
      • ReferenceCheckerWindow
      • ReferenceResolverMode
      • RuntimeMaterialProperties
      • RuntimeMaterialProperty
      • RuntimeMaterialPropertyType
      • SceneReferenceResolver
      • SceneReferenceResolverEditor
      • UnityEditorInternalException
    • Bayat.Core.EditorWindows
      • AssetReferenceManagerWindow
      • AssetReferenceManagerWindow.Styles
      • DatabaseMigrationWindow
      • DatabaseMigrationWindow.SceneMigrationStatus
      • DatabaseMigrationWindow.Styles
      • EditorWindowExtensions
      • EditorWindowUtility
      • EditorWindowWrapper
      • SceneReferenceManagerWindow
      • SceneReferenceManagerWindow.Styles
      • WindowClose
      • WrappedEditorWindow
    • Bayat.Core.Profiling
      • ProfiledSegment
      • ProfiledSegmentCollection
      • ProfilingScope
      • ProfilingUtility
    • Bayat.Core.Reflection
      • AssemblyExtensions
      • Codebase
      • RuntimeCodebase
      • TypeExtensions
      • TypeUtility
    • Bayat.Core.Text
      • StringExtensions
      • StringUtility
    • Bayat.Core.Utilities
      • ExceptionExtensions
      • GuidToReferenceDictionary
      • SerializableDictionary<TKey, TVal>
    • Bayat.Json
      • ConstructorHandling
      • CreateObjectConverterWindow
      • CreateObjectConverterWindow.Styles
      • DateFormatHandling
      • DateParseHandling
      • DateTimeZoneHandling
      • DefaultValueHandling
      • FloatFormatHandling
      • FloatParseHandling
      • Formatting
      • GameObjectSerializationHandler
      • GameObjectSerializationManagerTreeView
      • GameObjectSerializationManagerTreeView.Styles
      • GameObjectSerializationManagerWindow
      • GameObjectSerializationManagerWindow.Styles
      • IArrayPool<T>
      • IJsonLineInfo
      • JsonArrayAttribute
      • JsonConstructorAttribute
      • JsonContainerAttribute
      • JsonContainerType
      • JsonConvert
      • JsonConverter
      • JsonConverterAttribute
      • JsonConverterCollection
      • JsonDefaultSettingsWindow
      • JsonDefaultSettingsWindow.Styles
      • JsonDictionaryAttribute
      • JsonException
      • JsonExtensionDataAttribute
      • JsonIgnoreAttribute
      • JsonObjectAttribute
      • JsonPosition
      • JsonPropertyAttribute
      • JsonReader
      • JsonReader.State
      • JsonReaderException
      • JsonRequiredAttribute
      • JsonSerializationException
      • JsonSerializer
      • JsonSerializerSettings
      • JsonSerializerSettingsPreset
      • JsonTextReader
      • JsonTextWriter
      • JsonToken
      • JsonWriter
      • JsonWriter.State
      • JsonWriterException
      • MemberSerialization
      • MetadataPropertyHandling
      • MissingMemberHandling
      • NullValueHandling
      • ObjectCreationHandling
      • PreserveReferencesHandling
      • ReadType
      • ReferenceLoopHandling
      • Required
      • StringEscapeHandling
      • TypeNameHandling
      • WriteState
    • Bayat.Json.Bson
      • BsonArray
      • BsonBinary
      • BsonBinaryType
      • BsonBinaryWriter
      • BsonObject
      • BsonObjectId
      • BsonProperty
      • BsonReader
      • BsonRegex
      • BsonString
      • BsonToken
      • BsonType
      • BsonValue
      • BsonWriter
    • Bayat.Json.Converters
      • AnimatorConverter
      • AudioClipConverter
      • BinaryConverter
      • BoundsConverter
      • BsonObjectIdConverter
      • ColliderConverter
      • ColorConverter
      • CustomCreationConverter<T>
      • DateTimeConverterBase
      • DiscriminatedUnionConverter
      • EntityKeyMemberConverter
      • ExpandoObjectConverter
      • GameObjectConverter
      • HashSetConverter
      • IsoDateTimeConverter
      • JavaScriptDateTimeConverter
      • KeyValuePairConverter
      • MaterialConverter
      • MaterialConverter.JsonSerializedMaterialProperty
      • Matrix4x4Converter
      • MeshConverter
      • MeshConverter.SerializedIndices
      • MeshFilterConverter
      • ObjectJsonConverter
      • QuaternionConverter
      • RectConverter
      • RectTransformConverter
      • RegexConverter
      • RendererConverter
      • ResolutionConverter
      • ShaderConverter
      • SpriteConverter
      • StringEnumConverter
      • Texture2DConverter
      • TransformConverter
      • UnityBehaviourConverter
      • UnityComponentConverter
      • UnityMonoBehaviourConverter
      • UnityObjectConverter
      • UriConverter
      • VectorConverter
      • VersionConverter
      • XmlNodeConverter
    • Bayat.Json.Linq
      • CommentHandling
      • Extensions
      • IJEnumerable<T>
      • JArray
      • JConstructor
      • JContainer
      • JEnumerable<T>
      • JObject
      • JProperty
      • JPropertyDescriptor
      • JPropertyKeyedCollection
      • JRaw
      • JsonLoadSettings
      • JsonMergeSettings
      • JToken
      • JTokenEqualityComparer
      • JTokenReader
      • JTokenType
      • JTokenWriter
      • JValue
      • LineInfoHandling
      • MergeArrayHandling
      • MergeNullValueHandling
    • Bayat.Json.Linq.JsonPath
      • ArrayIndexFilter
      • ArrayMultipleIndexFilter
      • ArraySliceFilter
      • BooleanQueryExpression
      • CompositeExpression
      • FieldFilter
      • FieldMultipleFilter
      • JPath
      • PathFilter
      • QueryExpression
      • QueryFilter
      • QueryOperator
      • ScanFilter
    • Bayat.Json.Serialization
      • CachedAttributeGetter<T>
      • CamelCasePropertyNamesContractResolver
      • DefaultContractResolver
      • DefaultContractResolver.EnumerableDictionaryWrapper<TEnumeratorKey, TEnumeratorValue>
      • DefaultContractResolverState
      • DefaultReferenceResolver
      • DefaultSerializationBinder
      • DefaultSerializationBinder.TypeNameKey
      • DiagnosticsTraceWriter
      • ErrorContext
      • ErrorEventArgs
      • ExpressionValueProvider
      • ExtensionDataGetter
      • ExtensionDataSetter
      • IAttributeProvider
      • IContractResolver
      • IReferenceResolver
      • ITraceWriter
      • IValueProvider
      • JsonArrayContract
      • JsonContainerContract
      • JsonContract
      • JsonContractType
      • JsonDictionaryContract
      • JsonDynamicContract
      • JsonFormatterConverter
      • JsonISerializableContract
      • JsonLinqContract
      • JsonObjectContract
      • JsonPrimitiveContract
      • JsonProperty
      • JsonPropertyCollection
      • JsonSerializerInternalBase
      • JsonSerializerProxy
      • JsonSerializerReader
      • JsonSerializerReader.CreatorPropertyContext
      • JsonSerializerReader.PropertyPresence
      • JsonSerializerWriter
      • JsonStringContract
      • JsonTypeReflector
      • MemoryTraceWriter
      • ObjectConstructor<T>
      • OnErrorAttribute
      • ReflectionAttributeProvider
      • ReflectionValueProvider
      • ResolverContractKey
      • SerializationCallback
      • SerializationErrorCallback
      • TraceJsonReader
      • TraceJsonWriter
    • Bayat.Json.Shims
      • PreserveAttribute
    • Bayat.Json.Utilities
      • Base64Encoder
      • BidirectionalDictionary<TFirst, TSecond>
      • BufferUtils
      • CollectionUtils
      • CollectionWrapper<T>
      • ConvertUtils
      • ConvertUtils.ConvertResult
      • ConvertUtils.TypeConvertKey
      • Creator<T>
      • DateTimeParser
      • DateTimeUtils
      • DictionaryWrapper<TKey, TValue>
      • DynamicProxy<T>
      • DynamicProxyMetaObject<T>
      • DynamicUtils
      • DynamicUtils.BinderWrapper
      • EnumUtils
      • EnumValue<T>
      • ExpressionReflectionDelegateFactory
      • FSharpFunction
      • FSharpUtils
      • ImmutableCollectionsUtils
      • ImmutableCollectionsUtils.ImmutableCollectionTypeInfo
      • IWrappedCollection
      • IWrappedDictionary
      • JavaScriptUtils
      • JsonTokenUtils
      • LateBoundReflectionDelegateFactory
      • MathUtils
      • MethodCall<T, TResult>
      • MiscellaneousUtils
      • NoThrowExpressionVisitor
      • NoThrowGetBinderMember
      • NoThrowSetBinderMember
      • ParseResult
      • ParserTimeZone
      • PrimitiveTypeCode
      • PropertyNameTable
      • ReflectionDelegateFactory
      • ReflectionMember
      • ReflectionObject
      • ReflectionUtils
      • StringBuffer
      • StringReference
      • StringReferenceExtensions
      • StringUtils
      • ThreadSafeStore<TKey, TValue>
      • TypeInformation
      • ValidationUtils
    • Bayat.SaveSystem
      • AutoSave
      • AutoSaveManager
      • AutoSaveManager.LoadEvent
      • AutoSaveManager.SaveEvent
      • AutoSaveManagerWindow
      • AutoSaveManagerWindow.Styles
      • LoadEventArgs
      • LoadIntoEventArgs
      • SaveEventArgs
      • SaveSystemAPI
      • SaveSystemDefaultSettingsWindow
      • SaveSystemDefaultSettingsWindow.Styles
      • SaveSystemEditorResources
      • SaveSystemJsonSerializer
      • SaveSystemManager
      • SaveSystemSettings
      • SaveSystemSettingsPreset
      • WelcomeWindow
      • WelcomeWindow.Styles
    • Bayat.SaveSystem.Security
      • ISaveSystemEncryption
      • SaveSystemCryptoStream
      • SaveSystemSymmetricCryptoStream
      • SaveSystemSymmetricEncryption
    • Bayat.SaveSystem.Storage
      • BuiltInConnectionFactory
      • ConnectionStringFactory
      • FileStorageStream
      • IConnectionFactory
      • IStorage
      • IStorageStream
      • LocalDiskStorage
      • PlayerPrefsStorage
      • PlayerPrefsStorageStream
      • StorageBackup
      • StorageBase
      • StorageClearOperationResult
      • StorageConnectionString
      • StorageCopyOperationResult
      • StorageDeleteOperationResult
      • StorageFactory
      • StorageFullException
      • StorageInvalidIdentifierException
      • StorageItemNotFoundException
      • StorageListOptions
      • StorageMetaData
      • StorageMoveOperationResult
      • StorageOperationResult
      • StorageStream

    Class JsonSerializer

    Serializes and deserializes objects into and from the JSON format. The JsonSerializer enables you to control how objects are encoded into JSON.

    Inheritance
    System.Object
    JsonSerializer
    JsonSerializerProxy
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Bayat.Json
    Assembly: Bayat.Json.Runtime.dll
    Syntax
    public class JsonSerializer

    Constructors

    | Improve this Doc View Source

    JsonSerializer()

    Initializes a new instance of the JsonSerializer class.

    Declaration
    public JsonSerializer()

    Fields

    | Improve this Doc View Source

    _binder

    Declaration
    protected SerializationBinder _binder
    Field Value
    Type Description
    System.Runtime.Serialization.SerializationBinder
    | Improve this Doc View Source

    _checkAdditionalContent

    Declaration
    protected bool? _checkAdditionalContent
    Field Value
    Type Description
    System.Nullable<System.Boolean>
    | Improve this Doc View Source

    _constructorHandling

    Declaration
    protected ConstructorHandling _constructorHandling
    Field Value
    Type Description
    ConstructorHandling
    | Improve this Doc View Source

    _context

    Declaration
    protected StreamingContext _context
    Field Value
    Type Description
    System.Runtime.Serialization.StreamingContext
    | Improve this Doc View Source

    _contractResolver

    Declaration
    protected IContractResolver _contractResolver
    Field Value
    Type Description
    IContractResolver
    | Improve this Doc View Source

    _converters

    Declaration
    protected JsonConverterCollection _converters
    Field Value
    Type Description
    JsonConverterCollection
    | Improve this Doc View Source

    _culture

    Declaration
    protected CultureInfo _culture
    Field Value
    Type Description
    System.Globalization.CultureInfo
    | Improve this Doc View Source

    _dateFormatHandling

    Declaration
    protected DateFormatHandling? _dateFormatHandling
    Field Value
    Type Description
    System.Nullable<DateFormatHandling>
    | Improve this Doc View Source

    _dateFormatString

    Declaration
    protected string _dateFormatString
    Field Value
    Type Description
    System.String
    | Improve this Doc View Source

    _dateFormatStringSet

    Declaration
    protected bool _dateFormatStringSet
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    _dateParseHandling

    Declaration
    protected DateParseHandling? _dateParseHandling
    Field Value
    Type Description
    System.Nullable<DateParseHandling>
    | Improve this Doc View Source

    _dateTimeZoneHandling

    Declaration
    protected DateTimeZoneHandling? _dateTimeZoneHandling
    Field Value
    Type Description
    System.Nullable<DateTimeZoneHandling>
    | Improve this Doc View Source

    _defaultValueHandling

    Declaration
    protected DefaultValueHandling _defaultValueHandling
    Field Value
    Type Description
    DefaultValueHandling
    | Improve this Doc View Source

    _equalityComparer

    Declaration
    protected IEqualityComparer _equalityComparer
    Field Value
    Type Description
    System.Collections.IEqualityComparer
    | Improve this Doc View Source

    _floatFormatHandling

    Declaration
    protected FloatFormatHandling? _floatFormatHandling
    Field Value
    Type Description
    System.Nullable<FloatFormatHandling>
    | Improve this Doc View Source

    _floatParseHandling

    Declaration
    protected FloatParseHandling? _floatParseHandling
    Field Value
    Type Description
    System.Nullable<FloatParseHandling>
    | Improve this Doc View Source

    _formatting

    Declaration
    protected Formatting? _formatting
    Field Value
    Type Description
    System.Nullable<Formatting>
    | Improve this Doc View Source

    _maxDepth

    Declaration
    protected int? _maxDepth
    Field Value
    Type Description
    System.Nullable<System.Int32>
    | Improve this Doc View Source

    _maxDepthSet

    Declaration
    protected bool _maxDepthSet
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    _metadataPropertyHandling

    Declaration
    protected MetadataPropertyHandling _metadataPropertyHandling
    Field Value
    Type Description
    MetadataPropertyHandling
    | Improve this Doc View Source

    _missingMemberHandling

    Declaration
    protected MissingMemberHandling _missingMemberHandling
    Field Value
    Type Description
    MissingMemberHandling
    | Improve this Doc View Source

    _nullValueHandling

    Declaration
    protected NullValueHandling _nullValueHandling
    Field Value
    Type Description
    NullValueHandling
    | Improve this Doc View Source

    _objectCreationHandling

    Declaration
    protected ObjectCreationHandling _objectCreationHandling
    Field Value
    Type Description
    ObjectCreationHandling
    | Improve this Doc View Source

    _preserveReferencesHandling

    Declaration
    protected PreserveReferencesHandling _preserveReferencesHandling
    Field Value
    Type Description
    PreserveReferencesHandling
    | Improve this Doc View Source

    _referenceLoopHandling

    Declaration
    protected ReferenceLoopHandling _referenceLoopHandling
    Field Value
    Type Description
    ReferenceLoopHandling
    | Improve this Doc View Source

    _referenceResolver

    Declaration
    protected IReferenceResolver _referenceResolver
    Field Value
    Type Description
    IReferenceResolver
    | Improve this Doc View Source

    _serializeScriptableObjects

    Declaration
    protected bool? _serializeScriptableObjects
    Field Value
    Type Description
    System.Nullable<System.Boolean>
    | Improve this Doc View Source

    _stringEscapeHandling

    Declaration
    protected StringEscapeHandling? _stringEscapeHandling
    Field Value
    Type Description
    System.Nullable<StringEscapeHandling>
    | Improve this Doc View Source

    _traceWriter

    Declaration
    protected ITraceWriter _traceWriter
    Field Value
    Type Description
    ITraceWriter
    | Improve this Doc View Source

    _typeNameAssemblyFormat

    Declaration
    protected FormatterAssemblyStyle _typeNameAssemblyFormat
    Field Value
    Type Description
    System.Runtime.Serialization.Formatters.FormatterAssemblyStyle
    | Improve this Doc View Source

    _typeNameHandling

    Declaration
    protected TypeNameHandling _typeNameHandling
    Field Value
    Type Description
    TypeNameHandling
    | Improve this Doc View Source

    AvailableConverters

    Declaration
    public static readonly JsonConverter[] AvailableConverters
    Field Value
    Type Description
    JsonConverter[]

    Properties

    | Improve this Doc View Source

    Binder

    Gets or sets the System.Runtime.Serialization.SerializationBinder used by the serializer when resolving type names.

    Declaration
    public virtual SerializationBinder Binder { get; set; }
    Property Value
    Type Description
    System.Runtime.Serialization.SerializationBinder
    | Improve this Doc View Source

    CheckAdditionalContent

    Gets a value indicating whether there will be a check for additional JSON content after deserializing an object.

    Declaration
    public virtual bool CheckAdditionalContent { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if there will be a check for additional JSON content after deserializing an object; otherwise, false.

    | Improve this Doc View Source

    ConstructorHandling

    Gets or sets how constructors are used during deserialization.

    Declaration
    public virtual ConstructorHandling ConstructorHandling { get; set; }
    Property Value
    Type Description
    ConstructorHandling

    The constructor handling.

    | Improve this Doc View Source

    Context

    Gets or sets the System.Runtime.Serialization.StreamingContext used by the serializer when invoking serialization callback methods.

    Declaration
    public virtual StreamingContext Context { get; set; }
    Property Value
    Type Description
    System.Runtime.Serialization.StreamingContext

    The context.

    | Improve this Doc View Source

    ContractResolver

    Gets or sets the contract resolver used by the serializer when serializing .NET objects to JSON and vice versa.

    Declaration
    public virtual IContractResolver ContractResolver { get; set; }
    Property Value
    Type Description
    IContractResolver
    | Improve this Doc View Source

    Converters

    Gets a collection JsonConverter that will be used during serialization.

    Declaration
    public virtual JsonConverterCollection Converters { get; }
    Property Value
    Type Description
    JsonConverterCollection

    Collection JsonConverter that will be used during serialization.

    | Improve this Doc View Source

    Culture

    Gets or sets the culture used when reading JSON. Defaults to System.Globalization.CultureInfo.InvariantCulture.

    Declaration
    public virtual CultureInfo Culture { get; set; }
    Property Value
    Type Description
    System.Globalization.CultureInfo
    | Improve this Doc View Source

    DateFormatHandling

    Get or set how dates are written to JSON text.

    Declaration
    public virtual DateFormatHandling DateFormatHandling { get; set; }
    Property Value
    Type Description
    DateFormatHandling
    | Improve this Doc View Source

    DateFormatString

    Get or set how System.DateTime and System.DateTimeOffset values are formatted when writing JSON text, and the expected date format when reading JSON text.

    Declaration
    public virtual string DateFormatString { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    DateParseHandling

    Get or set how date formatted strings, e.g. "/Date(1198908717056)/" and "2012-03-21T05:40Z", are parsed when reading JSON.

    Declaration
    public virtual DateParseHandling DateParseHandling { get; set; }
    Property Value
    Type Description
    DateParseHandling
    | Improve this Doc View Source

    DateTimeZoneHandling

    Get or set how System.DateTime time zones are handling during serialization and deserialization.

    Declaration
    public virtual DateTimeZoneHandling DateTimeZoneHandling { get; set; }
    Property Value
    Type Description
    DateTimeZoneHandling
    | Improve this Doc View Source

    DefaultValueHandling

    Get or set how null default are handled during serialization and deserialization.

    Declaration
    public virtual DefaultValueHandling DefaultValueHandling { get; set; }
    Property Value
    Type Description
    DefaultValueHandling
    | Improve this Doc View Source

    EqualityComparer

    Gets or sets the equality comparer used by the serializer when comparing references.

    Declaration
    public virtual IEqualityComparer EqualityComparer { get; set; }
    Property Value
    Type Description
    System.Collections.IEqualityComparer

    The equality comparer.

    | Improve this Doc View Source

    FloatFormatHandling

    Get or set how special floating point numbers, e.g. System.Double.NaN, System.Double.PositiveInfinity and System.Double.NegativeInfinity, are written as JSON text.

    Declaration
    public virtual FloatFormatHandling FloatFormatHandling { get; set; }
    Property Value
    Type Description
    FloatFormatHandling
    | Improve this Doc View Source

    FloatParseHandling

    Get or set how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.

    Declaration
    public virtual FloatParseHandling FloatParseHandling { get; set; }
    Property Value
    Type Description
    FloatParseHandling
    | Improve this Doc View Source

    Formatting

    Indicates how JSON text output is formatted.

    Declaration
    public virtual Formatting Formatting { get; set; }
    Property Value
    Type Description
    Formatting
    | Improve this Doc View Source

    MaxDepth

    Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a JsonReaderException.

    Declaration
    public virtual int? MaxDepth { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>
    | Improve this Doc View Source

    MetadataPropertyHandling

    Gets or sets how metadata properties are used during deserialization.

    Declaration
    public virtual MetadataPropertyHandling MetadataPropertyHandling { get; set; }
    Property Value
    Type Description
    MetadataPropertyHandling

    The metadata properties handling.

    | Improve this Doc View Source

    MissingMemberHandling

    Get or set how missing members (e.g. JSON contains a property that isn't a member on the object) are handled during deserialization.

    Declaration
    public virtual MissingMemberHandling MissingMemberHandling { get; set; }
    Property Value
    Type Description
    MissingMemberHandling
    | Improve this Doc View Source

    NullValueHandling

    Get or set how null values are handled during serialization and deserialization.

    Declaration
    public virtual NullValueHandling NullValueHandling { get; set; }
    Property Value
    Type Description
    NullValueHandling
    | Improve this Doc View Source

    ObjectCreationHandling

    Gets or sets how objects are created during deserialization.

    Declaration
    public virtual ObjectCreationHandling ObjectCreationHandling { get; set; }
    Property Value
    Type Description
    ObjectCreationHandling

    The object creation handling.

    | Improve this Doc View Source

    PreserveReferencesHandling

    Gets or sets how object references are preserved by the serializer.

    Declaration
    public virtual PreserveReferencesHandling PreserveReferencesHandling { get; set; }
    Property Value
    Type Description
    PreserveReferencesHandling
    | Improve this Doc View Source

    ReferenceLoopHandling

    Get or set how reference loops (e.g. a class referencing itself) is handled.

    Declaration
    public virtual ReferenceLoopHandling ReferenceLoopHandling { get; set; }
    Property Value
    Type Description
    ReferenceLoopHandling
    | Improve this Doc View Source

    ReferenceResolver

    Gets or sets the IReferenceResolver used by the serializer when resolving references.

    Declaration
    public virtual IReferenceResolver ReferenceResolver { get; set; }
    Property Value
    Type Description
    IReferenceResolver
    | Improve this Doc View Source

    SerializeScriptableObjects

    Gets a value indicating whether to serialize ScriptableObjects data or not.

    Declaration
    public virtual bool SerializeScriptableObjects { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    StringEscapeHandling

    Get or set how strings are escaped when writing JSON text.

    Declaration
    public virtual StringEscapeHandling StringEscapeHandling { get; set; }
    Property Value
    Type Description
    StringEscapeHandling
    | Improve this Doc View Source

    TraceWriter

    Gets or sets the ITraceWriter used by the serializer when writing trace messages.

    Declaration
    public virtual ITraceWriter TraceWriter { get; set; }
    Property Value
    Type Description
    ITraceWriter

    The trace writer.

    | Improve this Doc View Source

    TypeNameAssemblyFormat

    Gets or sets how a type name assembly is written and resolved by the serializer.

    Declaration
    public virtual FormatterAssemblyStyle TypeNameAssemblyFormat { get; set; }
    Property Value
    Type Description
    System.Runtime.Serialization.Formatters.FormatterAssemblyStyle

    The type name assembly format.

    | Improve this Doc View Source

    TypeNameHandling

    Gets or sets how type name writing and reading is handled by the serializer.

    Declaration
    public virtual TypeNameHandling TypeNameHandling { get; set; }
    Property Value
    Type Description
    TypeNameHandling
    Remarks

    TypeNameHandling should be used with caution when your application deserializes JSON from an external source. Incoming types should be validated with a custom System.Runtime.Serialization.SerializationBinder when deserializing with a value other than TypeNameHandling.None.

    Methods

    | Improve this Doc View Source

    AddAllAvailableConverters()

    Declaration
    public void AddAllAvailableConverters()
    | Improve this Doc View Source

    AddAllAvailableObjectConverters()

    Declaration
    public void AddAllAvailableObjectConverters()
    | Improve this Doc View Source

    ApplySerializerSettings(JsonSerializer, JsonSerializerSettings)

    Declaration
    protected static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings)
    Parameters
    Type Name Description
    JsonSerializer serializer
    JsonSerializerSettings settings
    | Improve this Doc View Source

    Create()

    Creates a new JsonSerializer instance. The JsonSerializer will not use default settings from DefaultSettings.

    Declaration
    public static JsonSerializer Create()
    Returns
    Type Description
    JsonSerializer

    A new JsonSerializer instance. The JsonSerializer will not use default settings from DefaultSettings.

    | Improve this Doc View Source

    Create(JsonSerializerSettings)

    Creates a new JsonSerializer instance using the specified JsonSerializerSettings. The JsonSerializer will not use default settings from DefaultSettings.

    Declaration
    public static JsonSerializer Create(JsonSerializerSettings settings)
    Parameters
    Type Name Description
    JsonSerializerSettings settings

    The settings to be applied to the JsonSerializer.

    Returns
    Type Description
    JsonSerializer

    A new JsonSerializer instance using the specified JsonSerializerSettings. The JsonSerializer will not use default settings from DefaultSettings.

    | Improve this Doc View Source

    CreateDefault()

    Creates a new JsonSerializer instance. The JsonSerializer will use default settings from DefaultSettings.

    Declaration
    public static JsonSerializer CreateDefault()
    Returns
    Type Description
    JsonSerializer

    A new JsonSerializer instance. The JsonSerializer will use default settings from DefaultSettings.

    | Improve this Doc View Source

    CreateDefault(JsonSerializerSettings)

    Creates a new JsonSerializer instance using the specified JsonSerializerSettings. The JsonSerializer will use default settings from DefaultSettings as well as the specified JsonSerializerSettings.

    Declaration
    public static JsonSerializer CreateDefault(JsonSerializerSettings settings)
    Parameters
    Type Name Description
    JsonSerializerSettings settings

    The settings to be applied to the JsonSerializer.

    Returns
    Type Description
    JsonSerializer

    A new JsonSerializer instance using the specified JsonSerializerSettings. The JsonSerializer will use default settings from DefaultSettings as well as the specified JsonSerializerSettings.

    | Improve this Doc View Source

    Deserialize(JsonReader)

    Deserializes the JSON structure contained by the specified JsonReader.

    Declaration
    public object Deserialize(JsonReader reader)
    Parameters
    Type Name Description
    JsonReader reader

    The JsonReader that contains the JSON structure to deserialize.

    Returns
    Type Description
    System.Object

    The System.Object being deserialized.

    | Improve this Doc View Source

    Deserialize(JsonReader, Type)

    Deserializes the JSON structure contained by the specified JsonReader into an instance of the specified type.

    Declaration
    public object Deserialize(JsonReader reader, Type objectType)
    Parameters
    Type Name Description
    JsonReader reader

    The JsonReader containing the object.

    System.Type objectType

    The System.Type of object being deserialized.

    Returns
    Type Description
    System.Object

    The instance of objectType being deserialized.

    | Improve this Doc View Source

    Deserialize(TextReader, Type)

    Deserializes the JSON structure contained by the specified System.IO.StringReader into an instance of the specified type.

    Declaration
    public object Deserialize(TextReader reader, Type objectType)
    Parameters
    Type Name Description
    System.IO.TextReader reader

    The System.IO.TextReader containing the object.

    System.Type objectType

    The System.Type of object being deserialized.

    Returns
    Type Description
    System.Object

    The instance of objectType being deserialized.

    | Improve this Doc View Source

    Deserialize<T>(JsonReader)

    Deserializes the JSON structure contained by the specified JsonReader into an instance of the specified type.

    Declaration
    public T Deserialize<T>(JsonReader reader)
    Parameters
    Type Name Description
    JsonReader reader

    The JsonReader containing the object.

    Returns
    Type Description
    T

    The instance of T being deserialized.

    Type Parameters
    Name Description
    T

    The type of the object to deserialize.

    | Improve this Doc View Source

    DeserializeInternal(JsonReader, Type)

    Declaration
    protected virtual object DeserializeInternal(JsonReader reader, Type objectType)
    Parameters
    Type Name Description
    JsonReader reader
    System.Type objectType
    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    DeserializeInto(JsonReader, Object)

    Deserializes the JSON structure contained by the specified JsonReader into an instance of the specified type.

    Declaration
    public object DeserializeInto(JsonReader reader, object target)
    Parameters
    Type Name Description
    JsonReader reader

    The JsonReader containing the object.

    System.Object target

    The target object to populate values onto.

    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    DeserializeInto(TextReader, Object)

    Deserializes the JSON structure contained by the specified System.IO.StringReader into an instance of the specified type.

    Declaration
    public object DeserializeInto(TextReader reader, object target)
    Parameters
    Type Name Description
    System.IO.TextReader reader

    The System.IO.TextReader containing the object.

    System.Object target

    The target object to populate values onto.

    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    DeserializeIntoInternal(JsonReader, Object)

    Declaration
    protected virtual object DeserializeIntoInternal(JsonReader reader, object target)
    Parameters
    Type Name Description
    JsonReader reader
    System.Object target
    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    GetAllAvailableConverters()

    Declaration
    public static JsonConverter[] GetAllAvailableConverters()
    Returns
    Type Description
    JsonConverter[]
    | Improve this Doc View Source

    GetMatchingConverter(IList<JsonConverter>, Type)

    Declaration
    public static JsonConverter GetMatchingConverter(IList<JsonConverter> converters, Type objectType)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<JsonConverter> converters
    System.Type objectType
    Returns
    Type Description
    JsonConverter
    | Improve this Doc View Source

    GetMatchingConverter(Type)

    Declaration
    public JsonConverter GetMatchingConverter(Type type)
    Parameters
    Type Name Description
    System.Type type
    Returns
    Type Description
    JsonConverter
    | Improve this Doc View Source

    GetReferenceResolver()

    Declaration
    protected IReferenceResolver GetReferenceResolver()
    Returns
    Type Description
    IReferenceResolver
    | Improve this Doc View Source

    IsCheckAdditionalContentSet()

    Declaration
    public bool IsCheckAdditionalContentSet()
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    OnError(ErrorEventArgs)

    Declaration
    public void OnError(ErrorEventArgs e)
    Parameters
    Type Name Description
    ErrorEventArgs e
    | Improve this Doc View Source

    Populate(JsonReader, Object)

    Populates the JSON values onto the target object.

    Declaration
    public void Populate(JsonReader reader, object target)
    Parameters
    Type Name Description
    JsonReader reader

    The JsonReader that contains the JSON structure to reader values from.

    System.Object target

    The target object to populate values onto.

    | Improve this Doc View Source

    Populate(TextReader, Object)

    Populates the JSON values onto the target object.

    Declaration
    public void Populate(TextReader reader, object target)
    Parameters
    Type Name Description
    System.IO.TextReader reader

    The System.IO.TextReader that contains the JSON structure to reader values from.

    System.Object target

    The target object to populate values onto.

    | Improve this Doc View Source

    PopulateInternal(JsonReader, Object)

    Declaration
    protected virtual void PopulateInternal(JsonReader reader, object target)
    Parameters
    Type Name Description
    JsonReader reader
    System.Object target
    | Improve this Doc View Source

    Serialize(JsonWriter, Object)

    Serializes the specified System.Object and writes the JSON structure to a Stream using the specified JsonWriter.

    Declaration
    public void Serialize(JsonWriter jsonWriter, object value)
    Parameters
    Type Name Description
    JsonWriter jsonWriter

    The JsonWriter used to write the JSON structure.

    System.Object value

    The System.Object to serialize.

    | Improve this Doc View Source

    Serialize(JsonWriter, Object, Type)

    Serializes the specified System.Object and writes the JSON structure to a Stream using the specified System.IO.TextWriter.

    Declaration
    public void Serialize(JsonWriter jsonWriter, object value, Type objectType)
    Parameters
    Type Name Description
    JsonWriter jsonWriter

    The JsonWriter used to write the JSON structure.

    System.Object value

    The System.Object to serialize.

    System.Type objectType

    The type of the value being serialized. This parameter is used when TypeNameHandling is Auto to write out the type name if the type of the value does not match. Specifing the type is optional.

    | Improve this Doc View Source

    Serialize(TextWriter, Object)

    Serializes the specified System.Object and writes the JSON structure to a Stream using the specified System.IO.TextWriter.

    Declaration
    public void Serialize(TextWriter textWriter, object value)
    Parameters
    Type Name Description
    System.IO.TextWriter textWriter

    The System.IO.TextWriter used to write the JSON structure.

    System.Object value

    The System.Object to serialize.

    | Improve this Doc View Source

    Serialize(TextWriter, Object, Type)

    Serializes the specified System.Object and writes the JSON structure to a Stream using the specified System.IO.TextWriter.

    Declaration
    public void Serialize(TextWriter textWriter, object value, Type objectType)
    Parameters
    Type Name Description
    System.IO.TextWriter textWriter

    The System.IO.TextWriter used to write the JSON structure.

    System.Object value

    The System.Object to serialize.

    System.Type objectType

    The type of the value being serialized. This parameter is used when TypeNameHandling is Auto to write out the type name if the type of the value does not match. Specifing the type is optional.

    | Improve this Doc View Source

    SerializeInternal(JsonWriter, Object, Type)

    Declaration
    protected virtual void SerializeInternal(JsonWriter jsonWriter, object value, Type objectType)
    Parameters
    Type Name Description
    JsonWriter jsonWriter
    System.Object value
    System.Type objectType

    Events

    | Improve this Doc View Source

    Error

    Occurs when the JsonSerializer errors during serialization and deserialization.

    Declaration
    public virtual event EventHandler<ErrorEventArgs> Error
    Event Type
    Type Description
    System.EventHandler<ErrorEventArgs>
    • Improve this Doc
    • View Source
    • 0 Comments
    In This Article
    • Constructors
      • JsonSerializer()
    • Fields
      • _binder
      • _checkAdditionalContent
      • _constructorHandling
      • _context
      • _contractResolver
      • _converters
      • _culture
      • _dateFormatHandling
      • _dateFormatString
      • _dateFormatStringSet
      • _dateParseHandling
      • _dateTimeZoneHandling
      • _defaultValueHandling
      • _equalityComparer
      • _floatFormatHandling
      • _floatParseHandling
      • _formatting
      • _maxDepth
      • _maxDepthSet
      • _metadataPropertyHandling
      • _missingMemberHandling
      • _nullValueHandling
      • _objectCreationHandling
      • _preserveReferencesHandling
      • _referenceLoopHandling
      • _referenceResolver
      • _serializeScriptableObjects
      • _stringEscapeHandling
      • _traceWriter
      • _typeNameAssemblyFormat
      • _typeNameHandling
      • AvailableConverters
    • Properties
      • Binder
      • CheckAdditionalContent
      • ConstructorHandling
      • Context
      • ContractResolver
      • Converters
      • Culture
      • DateFormatHandling
      • DateFormatString
      • DateParseHandling
      • DateTimeZoneHandling
      • DefaultValueHandling
      • EqualityComparer
      • FloatFormatHandling
      • FloatParseHandling
      • Formatting
      • MaxDepth
      • MetadataPropertyHandling
      • MissingMemberHandling
      • NullValueHandling
      • ObjectCreationHandling
      • PreserveReferencesHandling
      • ReferenceLoopHandling
      • ReferenceResolver
      • SerializeScriptableObjects
      • StringEscapeHandling
      • TraceWriter
      • TypeNameAssemblyFormat
      • TypeNameHandling
    • Methods
      • AddAllAvailableConverters()
      • AddAllAvailableObjectConverters()
      • ApplySerializerSettings(JsonSerializer, JsonSerializerSettings)
      • Create()
      • Create(JsonSerializerSettings)
      • CreateDefault()
      • CreateDefault(JsonSerializerSettings)
      • Deserialize(JsonReader)
      • Deserialize(JsonReader, Type)
      • Deserialize(TextReader, Type)
      • Deserialize<T>(JsonReader)
      • DeserializeInternal(JsonReader, Type)
      • DeserializeInto(JsonReader, Object)
      • DeserializeInto(TextReader, Object)
      • DeserializeIntoInternal(JsonReader, Object)
      • GetAllAvailableConverters()
      • GetMatchingConverter(IList<JsonConverter>, Type)
      • GetMatchingConverter(Type)
      • GetReferenceResolver()
      • IsCheckAdditionalContentSet()
      • OnError(ErrorEventArgs)
      • Populate(JsonReader, Object)
      • Populate(TextReader, Object)
      • PopulateInternal(JsonReader, Object)
      • Serialize(JsonWriter, Object)
      • Serialize(JsonWriter, Object, Type)
      • Serialize(TextWriter, Object)
      • Serialize(TextWriter, Object, Type)
      • SerializeInternal(JsonWriter, Object, Type)
    • Events
      • Error