0

I have an abstract type from which derives many others. On this abstract type I have a custom attribute [JsonConverter(typeof(BasicJsonConverter))], BasicJsonConverter override method Create of class AbstractJsonConverter (class is inspired from here).

Now my problem is that in GET calls json is camel cased which is good, but for POST or PUT calls json is pascal cased. I've tried to register it in GlobalConfig or in WebApiConfig like this:

  json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); 

but no result.

Any help to get all calls camel cased will be much appreciated.

Ioana Stoian
  • 146
  • 1
  • 10

1 Answers1

1

If I understand correctly then your problem is like this.

  1. If you make you API Call if you have Get API call so get CamelCased Json from Response from API.

  2. When you post or put data to API then it is not CamelCased. Right ?

If above is your case then It is correct behavior.

ContractResolver role is format response data not request data.

dotnetstep
  • 17,065
  • 5
  • 54
  • 72