RicoSuter / NJsonSchema

JSON Schema reader, generator and validator for .NET
http://NJsonSchema.org
MIT License
1.37k stars 529 forks source link

JsonProperty not working on version 11.0.0 (working on 10.9.0) #1696

Open CaseyHofland opened 4 months ago

CaseyHofland commented 4 months ago

On version 11.0.0, When I var json = JsonSchema.FromType<MyType>().ToJson();, [JsonProperty("stuff")] will be ignored.

When I'm on version 10.9.0, it works.

Thought I'd let you know :)

devlux commented 2 months ago

hi @CaseyHofland

I run into the same issue and was able to fix it by using

var json = NewtonsoftJsonSchemaGenerator.FromType<MyType>().ToJson();

By default JsonSchema.FromType now uses System.Text.Json and therefore doesn't consider Newtonsoft annotations.