Hi,
Any action attribute can disable automatic camel case conversion of return Json result? Thanks.
3 Answer(s)
-
0
Hi,
You can check this issue <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/769">https://github.com/aspnetboilerplate/as ... issues/769</a>.
-
0
<cite>ismcagdas: </cite> Hi,
You can check this issue <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/769">https://github.com/aspnetboilerplate/as ... issues/769</a>.
So I need import Abp.Web.MVC into my Application project to using AbpJson? Possible to give a code sample for application function for reference? Thanks!
-
0
Hi,
I think I missunderstand your question.
If you want your ApplicationService methods to return some other type of json result instead of Camel Case, you can define a custom ContractResolver for Json.NET like this.
public class CustomCasePropertyNamesContractResolver : DefaultContractResolver { ... }
Then in your Web API module's initialize method, use it instead of Camel Case resolver.
Configuration.Modules.AbpWebApi().HttpConfiguration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CustomCasePropertyNamesContractResolver ();
I hope this helps.