@@ -37,8 +37,9 @@ public static JsConfigScope With(
3737 bool ? includeTypeInfo = null ,
3838 bool ? emitCamelCaseNames = null ,
3939 bool ? emitLowercaseUnderscoreNames = null ,
40- JsonDateHandler ? dateHandler = null ,
41- JsonTimeSpanHandler ? timeSpanHandler = null ,
40+ DateHandler ? dateHandler = null ,
41+ TimeSpanHandler ? timeSpanHandler = null ,
42+ PropertyConvention ? propertyConvention = null ,
4243 bool ? preferInterfaces = null ,
4344 bool ? throwOnDeserializationError = null ,
4445 string typeAttr = null ,
@@ -65,6 +66,7 @@ public static JsConfigScope With(
6566 EmitLowercaseUnderscoreNames = emitLowercaseUnderscoreNames ?? sEmitLowercaseUnderscoreNames ,
6667 DateHandler = dateHandler ?? sDateHandler ,
6768 TimeSpanHandler = timeSpanHandler ?? sTimeSpanHandler ,
69+ PropertyConvention = propertyConvention ?? sPropertyConvention ,
6870 PreferInterfaces = preferInterfaces ?? sPreferInterfaces ,
6971 ThrowOnDeserializationError = throwOnDeserializationError ?? sThrowOnDeserializationError ,
7072 TypeAttr = typeAttr ?? sTypeAttr ,
@@ -266,14 +268,14 @@ public static Func<string, Type> TypeFinder
266268 }
267269 }
268270
269- private static JsonDateHandler ? sDateHandler ;
270- public static JsonDateHandler DateHandler
271+ private static DateHandler ? sDateHandler ;
272+ public static DateHandler DateHandler
271273 {
272274 get
273275 {
274276 return ( JsConfigScope . Current != null ? JsConfigScope . Current . DateHandler : null )
275277 ?? sDateHandler
276- ?? JsonDateHandler . TimestampOffset ;
278+ ?? DateHandler . TimestampOffset ;
277279 }
278280 set
279281 {
@@ -284,14 +286,14 @@ public static JsonDateHandler DateHandler
284286 /// <summary>
285287 /// Sets which format to use when serializing TimeSpans
286288 /// </summary>
287- private static JsonTimeSpanHandler ? sTimeSpanHandler ;
288- public static JsonTimeSpanHandler TimeSpanHandler
289+ private static TimeSpanHandler ? sTimeSpanHandler ;
290+ public static TimeSpanHandler TimeSpanHandler
289291 {
290292 get
291293 {
292294 return ( JsConfigScope . Current != null ? JsConfigScope . Current . TimeSpanHandler : null )
293295 ?? sTimeSpanHandler
294- ?? JsonTimeSpanHandler . DurationFormat ;
296+ ?? TimeSpanHandler . DurationFormat ;
295297 }
296298 set
297299 {
@@ -345,22 +347,18 @@ public static bool EmitLowercaseUnderscoreNames
345347 /// <summary>
346348 /// Define how property names are mapped during deserialization
347349 /// </summary>
348- private static JsonPropertyConvention propertyConvention ;
349- public static JsonPropertyConvention PropertyConvention
350+ private static PropertyConvention ? sPropertyConvention ;
351+ public static PropertyConvention PropertyConvention
350352 {
351- get { return propertyConvention ; }
353+ get
354+ {
355+ return ( JsConfigScope . Current != null ? JsConfigScope . Current . PropertyConvention : null )
356+ ?? sPropertyConvention
357+ ?? PropertyConvention . Strict ;
358+ }
352359 set
353360 {
354- propertyConvention = value ;
355- switch ( propertyConvention )
356- {
357- case JsonPropertyConvention . ExactMatch :
358- DeserializeTypeRefJson . PropertyNameResolver = DeserializeTypeRefJson . DefaultPropertyNameResolver ;
359- break ;
360- case JsonPropertyConvention . Lenient :
361- DeserializeTypeRefJson . PropertyNameResolver = DeserializeTypeRefJson . LenientPropertyNameResolver ;
362- break ;
363- }
361+ if ( ! sPropertyConvention . HasValue ) sPropertyConvention = value ;
364362 }
365363 }
366364
@@ -611,7 +609,7 @@ public static void Reset()
611609 sIncludePublicFields = null ;
612610 HasSerializeFn = new HashSet < Type > ( ) ;
613611 TreatValueAsRefTypes = new HashSet < Type > { typeof ( KeyValuePair < , > ) } ;
614- PropertyConvention = JsonPropertyConvention . ExactMatch ;
612+ sPropertyConvention = null ;
615613 sExcludePropertyReferences = null ;
616614 sExcludeTypes = new HashSet < Type > { typeof ( Stream ) } ;
617615 __uniqueTypes = new HashSet < Type > ( ) ;
@@ -1030,19 +1028,19 @@ public static void Reset()
10301028 }
10311029 }
10321030
1033- public enum JsonPropertyConvention
1031+ public enum PropertyConvention
10341032 {
10351033 /// <summary>
10361034 /// The property names on target types must match property names in the JSON source
10371035 /// </summary>
1038- ExactMatch ,
1036+ Strict ,
10391037 /// <summary>
10401038 /// The property names on target types may not match the property names in the JSON source
10411039 /// </summary>
10421040 Lenient
10431041 }
10441042
1045- public enum JsonDateHandler
1043+ public enum DateHandler
10461044 {
10471045 TimestampOffset ,
10481046 DCJSCompatible ,
@@ -1052,7 +1050,7 @@ public enum JsonDateHandler
10521050 UnixTimeMs ,
10531051 }
10541052
1055- public enum JsonTimeSpanHandler
1053+ public enum TimeSpanHandler
10561054 {
10571055 /// <summary>
10581056 /// Uses the xsd format like PT15H10M20S
0 commit comments