11// Copyright (c) Just Eat, 2017. All rights reserved.
22// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
33
4- using Newtonsoft . Json ;
5- using Newtonsoft . Json . Linq ;
4+ using System . Text . Json ;
5+ using System . Text . Json . Serialization ;
66
77namespace JustEat . HttpClientInterception . Bundles ;
88
@@ -16,102 +16,129 @@ internal sealed class BundleItem
1616 /// <summary>
1717 /// Gets or sets the optional Id of the item.
1818 /// </summary>
19- [ JsonProperty ( "id" , NullValueHandling = NullValueHandling . Ignore ) ]
19+ [ JsonPropertyName ( "id" ) ]
20+ #if NET6_0_OR_GREATER
21+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
22+ #endif
2023 public string ? Id { get ; set ; }
2124
2225 /// <summary>
2326 /// Gets or sets the optional comment for the item.
2427 /// </summary>
25- [ JsonProperty ( "comment" , NullValueHandling = NullValueHandling . Ignore ) ]
28+ [ JsonPropertyName ( "comment" ) ]
29+ #if NET6_0_OR_GREATER
30+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
31+ #endif
2632 public string ? Comment { get ; set ; }
2733
2834 /// <summary>
2935 /// Gets or sets the optional HTTP version for the item.
3036 /// </summary>
31- [ JsonProperty ( "version" , NullValueHandling = NullValueHandling . Ignore ) ]
37+ [ JsonPropertyName ( "version" ) ]
38+ #if NET6_0_OR_GREATER
39+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
40+ #endif
3241 public string ? Version { get ; set ; }
3342
3443 /// <summary>
3544 /// Gets or sets the default HTTP method for the item.
3645 /// </summary>
37- [ JsonProperty ( "method" ) ]
46+ [ JsonPropertyName ( "method" ) ]
3847 public string ? Method { get ; set ; }
3948
4049 /// <summary>
4150 /// Gets or sets the request URI for the item.
4251 /// </summary>
43- [ JsonProperty ( "uri" ) ]
52+ [ JsonPropertyName ( "uri" ) ]
4453 public string ? Uri { get ; set ; }
4554
4655 /// <summary>
4756 /// Gets or sets the optional priority for the item.
4857 /// </summary>
49- [ JsonProperty ( "priority" , NullValueHandling = NullValueHandling . Ignore ) ]
58+ [ JsonPropertyName ( "priority" ) ]
59+ #if NET6_0_OR_GREATER
60+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
61+ #endif
5062 public int ? Priority { get ; set ; }
5163
5264 /// <summary>
5365 /// Gets or sets the HTTP status code for the response for item.
5466 /// </summary>
55- [ JsonProperty ( "status" , NullValueHandling = NullValueHandling . Ignore ) ]
67+ [ JsonPropertyName ( "status" ) ]
68+ #if NET6_0_OR_GREATER
69+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
70+ #endif
5671 public string ? Status { get ; set ; }
5772
5873 /// <summary>
5974 /// Gets or sets the optional request headers for the item.
6075 /// </summary>
61- [ JsonProperty ( "requestHeaders" , NullValueHandling = NullValueHandling . Ignore ) ]
76+ [ JsonPropertyName ( "requestHeaders" ) ]
77+ #if NET6_0_OR_GREATER
78+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
79+ #endif
6280 public IDictionary < string , ICollection < string > > ? RequestHeaders { get ; set ; }
6381
6482 /// <summary>
6583 /// Gets or sets the optional response headers for the item.
6684 /// </summary>
67- [ JsonProperty ( "responseHeaders" , NullValueHandling = NullValueHandling . Ignore ) ]
85+ [ JsonPropertyName ( "responseHeaders" ) ]
86+ #if NET6_0_OR_GREATER
87+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
88+ #endif
6889 public IDictionary < string , ICollection < string > > ? ResponseHeaders { get ; set ; }
6990
7091 /// <summary>
7192 /// Gets or sets the optional content headers for the item.
7293 /// </summary>
73- [ JsonProperty ( "contentHeaders" , NullValueHandling = NullValueHandling . Ignore ) ]
94+ [ JsonPropertyName ( "contentHeaders" ) ]
95+ #if NET6_0_OR_GREATER
96+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
97+ #endif
7498 public IDictionary < string , ICollection < string > > ? ContentHeaders { get ; set ; }
7599
76100 /// <summary>
77101 /// Gets or sets the optional content format of the item.
78102 /// </summary>
79- [ JsonProperty ( "contentFormat" ) ]
103+ [ JsonPropertyName ( "contentFormat" ) ]
80104 public string ? ContentFormat { get ; set ; }
81105
82106 /// <summary>
83107 /// Gets or sets the content of the item as JSON.
84108 /// </summary>
85- [ JsonProperty ( "contentJson" ) ]
86- public JToken ? ContentJson { get ; set ; }
109+ [ JsonPropertyName ( "contentJson" ) ]
110+ public JsonElement ContentJson { get ; set ; }
87111
88112 /// <summary>
89113 /// Gets or sets the content of the item as a string.
90114 /// </summary>
91- [ JsonProperty ( "contentString" ) ]
115+ [ JsonPropertyName ( "contentString" ) ]
92116 public string ? ContentString { get ; set ; }
93117
94118 /// <summary>
95119 /// Gets or sets the optional templating values.
96120 /// </summary>
97- [ JsonProperty ( "templateValues" , NullValueHandling = NullValueHandling . Ignore ) ]
121+ [ JsonPropertyName ( "templateValues" ) ]
122+ #if NET6_0_OR_GREATER
123+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingNull ) ]
124+ #endif
98125 public IDictionary < string , string > ? TemplateValues { get ; set ; }
99126
100127 /// <summary>
101128 /// Gets or sets a value indicating whether to ignore the URI's path.
102129 /// </summary>
103- [ JsonProperty ( "ignorePath" , NullValueHandling = NullValueHandling . Ignore ) ]
130+ [ JsonPropertyName ( "ignorePath" ) ]
104131 public bool IgnorePath { get ; set ; }
105132
106133 /// <summary>
107134 /// Gets or sets a value indicating whether to ignore the URI's query string.
108135 /// </summary>
109- [ JsonProperty ( "ignoreQuery" , NullValueHandling = NullValueHandling . Ignore ) ]
136+ [ JsonPropertyName ( "ignoreQuery" ) ]
110137 public bool IgnoreQuery { get ; set ; }
111138
112139 /// <summary>
113140 /// Gets or sets a value indicating whether to skip the item.
114141 /// </summary>
115- [ JsonProperty ( "skip" , NullValueHandling = NullValueHandling . Ignore ) ]
142+ [ JsonPropertyName ( "skip" ) ]
116143 public bool Skip { get ; set ; }
117144}
0 commit comments