Aspnetcore.docs: Add warning on "Microsoft.AspNet.WebApi.Client" still using "Newtonsoft.Json"

Created on 18 Oct 2019  Â·  2Comments  Â·  Source: dotnet/AspNetCore.Docs

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.

Source - Docs.ms doc-enhancement

Most helpful comment

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.

All 2 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings