If you want to see the history, you can check out this issue on the ASP.NET Core MVC GitHub.
As mentioned, the default is now camelCase. If you need/want all of the JSON output to be in PascalCase, then the solution is pretty simple.
All you need to do is specify the
Another option, which I chose to use, is to specify an accept header of application/json but with an profile.
Darrel Miller pointed this out to me a couple years ago.
@derek_comartin "profile" is a almost standard way of layering additional semantics on top of an existing media type https://t.co/R90hVZF5s5
— Darrel Miller (@darrel_miller) September 1, 2015
Profiles are defined in section 3 of RFC6906:
The concept of a profile has no strict definition on the Internet or
on the web. For the purpose of this specification, a profile can be
described as additional semantics that can be used to process a
resource representation, such as constraints, conventions,
extensions, or any other aspects that do not alter the basic media
What this could look like for us is defining the accept header of our request as:
One of the ways I found to implement this in ASP.NET Core MVC is with an Output Formatter.
What we can do is define a new custom output formatter that will be used when the request accepts
Now to use this new output formatter, we must specify in our
Here is a request with the profile defined in the accept header to return PascalCase.
Then another request without the profile, which is just a standard application/json, which by default is camelCase.
This is one specific use case of using a custom output formatter. There are likely many different situations you may run into where it might be a good fit to create one.
Have you written a custom output formatter? If so, I’d love to hear about it in the comments or on Twitter.Follow @codeopinion