public JsonSerializer()
 {
     this._referenceLoopHandling      = Newtonsoft.Json.ReferenceLoopHandling.Error;
     this._missingMemberHandling      = Newtonsoft.Json.MissingMemberHandling.Ignore;
     this._nullValueHandling          = Newtonsoft.Json.NullValueHandling.Include;
     this._defaultValueHandling       = Newtonsoft.Json.DefaultValueHandling.Include;
     this._objectCreationHandling     = Newtonsoft.Json.ObjectCreationHandling.Auto;
     this._preserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;
     this._constructorHandling        = Newtonsoft.Json.ConstructorHandling.Default;
     this._typeNameHandling           = Newtonsoft.Json.TypeNameHandling.None;
     this._context = JsonSerializerSettings.DefaultContext;
     this._binder  = DefaultSerializationBinder.Instance;
 }
Exemple #2
0
 public JsonSerializerSettings()
 {
     this.ReferenceLoopHandling      = Newtonsoft.Json.ReferenceLoopHandling.Error;
     this.MissingMemberHandling      = Newtonsoft.Json.MissingMemberHandling.Ignore;
     this.ObjectCreationHandling     = Newtonsoft.Json.ObjectCreationHandling.Auto;
     this.NullValueHandling          = Newtonsoft.Json.NullValueHandling.Include;
     this.DefaultValueHandling       = Newtonsoft.Json.DefaultValueHandling.Include;
     this.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;
     this.TypeNameHandling           = Newtonsoft.Json.TypeNameHandling.None;
     this.TypeNameAssemblyFormat     = FormatterAssemblyStyle.Simple;
     this.Context    = JsonSerializerSettings.DefaultContext;
     this.Converters = new List <JsonConverter>();
 }
Exemple #3
0
 public JsonSerializer()
 {
     Class6.yDnXvgqzyB5jw();
     base();
     this._referenceLoopHandling      = Newtonsoft.Json.ReferenceLoopHandling.Error;
     this._missingMemberHandling      = Newtonsoft.Json.MissingMemberHandling.Ignore;
     this._nullValueHandling          = Newtonsoft.Json.NullValueHandling.Include;
     this._defaultValueHandling       = Newtonsoft.Json.DefaultValueHandling.Include;
     this._objectCreationHandling     = Newtonsoft.Json.ObjectCreationHandling.Auto;
     this._preserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;
     this._constructorHandling        = Newtonsoft.Json.ConstructorHandling.Default;
     this._typeNameHandling           = Newtonsoft.Json.TypeNameHandling.None;
     this._metadataPropertyHandling   = Newtonsoft.Json.MetadataPropertyHandling.Default;
     this._context             = JsonSerializerSettings.DefaultContext;
     this._serializationBinder = DefaultSerializationBinder.Instance;
     this._culture             = JsonSerializerSettings.DefaultCulture;
     this._contractResolver    = DefaultContractResolver.Instance;
 }
Exemple #4
0
        public static string JsonSave(object data, bool includeNonPublic = false, Newtonsoft.Json.TypeNameHandling typeNameHandling = Newtonsoft.Json.TypeNameHandling.Auto)
        {
            using (System.IO.StringWriter swriter = new System.IO.StringWriter())
            {
                Newtonsoft.Json.JsonSerializer ser = new Newtonsoft.Json.JsonSerializer();
                Newtonsoft.Json.Serialization.DefaultContractResolver dcr = new Newtonsoft.Json.Serialization.DefaultContractResolver();
                if (includeNonPublic)
                {
#pragma warning disable CS0618 // Type or member is obsolete
                    dcr.DefaultMembersSearchFlags |= System.Reflection.BindingFlags.NonPublic;
#pragma warning restore CS0618 // Type or member is obsolete
                }
                ser.ContractResolver  = dcr;
                ser.TypeNameHandling  = typeNameHandling;
                ser.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
                ser.Serialize(swriter, data);
                return(swriter.ToString());
            }
        }