JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.72k stars 3.25k forks source link

Json converter doesn't recognize property name in uppercase format #2805

Open morozenkomv opened 1 year ago

morozenkomv commented 1 year ago

Source/destination types

    [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.16.1.0 (NJsonSchema v10.7.2.0 (Newtonsoft.Json v13.0.0.0))")]
    public partial class TaxRegion
    {
        [Newtonsoft.Json.JsonProperty("C_REG", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public int C_REG { get; set; }

        [Newtonsoft.Json.JsonProperty("NAME_REG", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
        public string NAME_REG { get; set; }

    }

Expected behavior

{ "C_REG": 1, "NAME_REG": "Green apple" }

Actual behavior

{ "c_REG": 1, "namE_REG": "Green apple" }

Steps to reproduce

return from c# controller

return new TaxRegion { C_REG = 1, NAME_REG = "Green apple" }

This issue preproduced in Azure functions as well https://github.com/Azure/Azure-Functions/issues/2233

elgonzo commented 1 year ago

Which Json converter?

If you have problems with how Azure configures Newtonsoft.Json, then this Newtonsoft.Json issue tracker here is not the best place to seek a solution and it would probably be better to inquire the Azure folks and/or some Azure experts about how you could possibly influence how Azure configures Newtonsoft.Json.