Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

JSON response formatting is different from ASP.NET Core #2769

Closed
MartinZikmund opened this issue Nov 2, 2018 · 6 comments
Closed

JSON response formatting is different from ASP.NET Core #2769

MartinZikmund opened this issue Nov 2, 2018 · 6 comments
Labels

Comments

@MartinZikmund
Copy link

Issue / Steps to reproduce the problem

The HttpResponseExtensions class writes JSON responses in PascalCase format instead of camelCase which is the ASP.NET Core default. It would be great if it was possible to at least configure this, or set the default to match ASP.NET Core.

@leastprivilege
Copy link
Member

Why? What's the scenario?

@MartinZikmund
Copy link
Author

Many of the Identity server responses are using WriteJsonAsync to write the JSON response. Unfortunately this is currently using the default JSON.NET PascalCase formatting and is not easily configurable.

In version 1.0 ASP.NET Core has started using camelCase formatting, as it is more in line with the rest of the world see announement here and discussion here.

This means now that if we are following the default ASP.NET Core convention, all Web API responses are now coming as camelCase, while responses from IdentityServer4 are coming as PascalCase. It is not a problem just an inconsistency and in result the API does not look as a single unit. It would be great if
JsonSerializerSettings were exposed so that they were configurable.

@leastprivilege
Copy link
Member

Can you give me an example?

I would say most things we write to the response have the exact casing per specification.

@brockallen
Copy link
Member

Anything else to add to this?

@MartinZikmund
Copy link
Author

Sorry, it was on our side :-) . We were using the HttpResponseExtensions class to output JSON to the response. However, it is surprising this class is marked as public as it seems as an internal utility class.

@lock
Copy link

lock bot commented Jan 12, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants