File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
src/GitLabApiClient/Internal/Http/Serialization Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -5,20 +5,18 @@ namespace GitLabApiClient.Internal.Http.Serialization
55{
66 internal sealed class RequestsJsonSerializer
77 {
8- static RequestsJsonSerializer ( ) => JsonConvert . DefaultSettings = ( ) =>
9- {
10- var settings = new JsonSerializerSettings
8+ private static readonly JsonSerializerSettings Settings ;
9+
10+ static RequestsJsonSerializer ( )
11+ => Settings = new JsonSerializerSettings
1112 {
1213 NullValueHandling = NullValueHandling . Ignore ,
13- ContractResolver = new EmptyCollectionContractResolver ( )
14+ ContractResolver = new EmptyCollectionContractResolver ( ) ,
15+ Converters = { new StringEnumConverter ( ) }
1416 } ;
1517
16- settings . Converters . Add ( new StringEnumConverter ( ) ) ;
17- return settings ;
18- } ;
19-
20- public string Serialize ( object obj ) => JsonConvert . SerializeObject ( obj ) ;
18+ public string Serialize ( object obj ) => JsonConvert . SerializeObject ( obj , Settings ) ;
2119
22- public T Deserialize < T > ( string serializeJson ) => JsonConvert . DeserializeObject < T > ( serializeJson ) ;
20+ public T Deserialize < T > ( string serializeJson ) => JsonConvert . DeserializeObject < T > ( serializeJson , Settings ) ;
2321 }
2422}
You can’t perform that action at this time.
0 commit comments