Integrate custom Newtonsoft.Json.JsonConverter
and minor tweaks to use Json.NET in Unity.
More...
Static Public Attributes | |
static readonly IList< JsonConverter > | converters = CreateConverters() |
The default custom converters. More... | |
static readonly JsonSerializerSettings | defaultSettings |
The default Newtonsoft.Json.JsonSerializerSettings . More... | |
Integrate custom Newtonsoft.Json.JsonConverter
and minor tweaks to use Json.NET in Unity.
To use Json.NET, please set Unity "PlayerSettings/Api Compatibility Lavel" to .NET 2.0. Then download from its website and import the .NET 2.0 dll. The defaultSettings
is assigned to JsonConvert.DefaultSettings
when initializing.
The defaultSettings
with the tweaks below:
UnityEngine.Vector3
.DataContractResolver
to make sure serializing custom class as expection.ObjectCreationHandling.Replace
to make sure deserialized data identical with the text. Now we can use Json.NET just like before:
User can directly modify defaultSettings
for customization, and override it:
|
static |
The default custom converters.
Includes below:
Newtonsoft.Json.JsonConverter
has constructor without parameters.Newtonsoft.Json.JsonConverter
from WanzyeeStudio.Json
.Newtonsoft.Json.Converters.StringEnumConverter
.Newtonsoft.Json.Converters.VersionConverter
.
|
static |
The default Newtonsoft.Json.JsonSerializerSettings
.