Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
3 participants
@MartinZikmund
Copy link

commented Nov 2, 2018

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

This comment has been minimized.

Copy link
Member

commented Nov 2, 2018

Why? What's the scenario?

@MartinZikmund

This comment has been minimized.

Copy link
Author

commented Nov 2, 2018

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

This comment has been minimized.

Copy link
Member

commented Nov 2, 2018

Can you give me an example?

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

@brockallen

This comment has been minimized.

Copy link
Member

commented Nov 4, 2018

Anything else to add to this?

@MartinZikmund

This comment has been minimized.

Copy link
Author

commented Nov 4, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.