Closed iRubens closed 1 year ago
@JamesNK please review and suggest an edit.
Out of curiosity, will Microsoft.AspNet.WebApi.Client
swap over to System.Text.Json
in v6 or later?
I've just written some code with a dependency on just Microsoft.AspNet.WebApi.Client
, so the Newtonsoft.Json
dep is transitive. I'm guessing that'll mean if you guys shift over to System.Text.Json
instead, JsonProperty
won't exist anymore and the build will break; that's great - it'll fail fast. But there's definitely projects I can imagine that will have Newtonsoft.Json
still in the dependency tree and people will just forget to update their JsonProperty
attributes.
I guess at the end of the day if it's a major version update for Microsoft.AspNet.WebApi.Client
there just needs to be ample documentation and warning for folks. It'd be great if this could be covered by an analyzer, but that could be very hard.
On .NET 6 use:
using System.Net.Http.Json;
Further to @bnayae's comment, there was a new package created called System.Net.Http.Json
that contains similar extension methods but that uses System.Text.Json.JsonSerializer
.
It actually targets netstandard2.0
, so you can use it on net461
even.
So to answer my question from above, nope, it looks like the old package is dead.
If someone is using "Microsoft.AspNet.WebApi.Client" but migrated from "JsonPropertyAttribute" (Newtonsoft.Json) to "JsonPropertynameAttribute" (System.Text.Json) the serialization property names are ignored. Please add a warning on the "Microsoft.AspNet.WebApi.Client" chapter that is still necessary to keep previous attributes or provide a way to change the JSON serializer.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Associated WorkItem - 97038