Skip to content

Add guidance for migration from Newtonsoft Attribute JsonObject Property Title #45862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jafin opened this issue Apr 19, 2025 · 0 comments
Open

Comments

@jafin
Copy link

jafin commented Apr 19, 2025

Type of issue

Missing information

Description

For consideration

Newtonsoft.Json has the attribute

[JsonObject(Title = "title")]

Could you please provide documentation guidance (or note that it is not supported) on migrating from Newtonsoft.Json Attribute Property Title which is used for metadata schema generation.

My understanding is there is no parallel in System.Text.Json and the common option is just to rename the Class to the appropriate name.

Perhaps this is out of scope for Migration, given this is schema related, and maybe belongs closer to the OpenApi docs? unsure.

I can see that for OpenApi something like this can be done,

public class RenameSchemaTransformer : IDocumentTransformer
{
    public void Apply(OpenApiDocument document, OpenApiDocumentTransformerContext context)
    {
        if (document.Components.Schemas.TryGetValue("Address", out var schema))
        {
            document.Components.Schemas.Remove("Address");
            schema.Title = "address";
            document.Components.Schemas["address"] = schema;
        }
    }
}

Page URL

https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft

Content source URL

https://github.com/dotnet/docs/blob/main/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md

Document Version Independent Id

9c6a7135-eb75-21a9-1d27-0880459523ca

Platform Id

b4170058-145b-31e8-164f-9f71770c2ef2

Article author

@gewarren

Metadata

  • ID: 6b74d77c-33e1-d44c-18c6-bd0b612f74de
  • PlatformId: b4170058-145b-31e8-164f-9f71770c2ef2
  • Service: dotnet-fundamentals

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant