question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

in asp.net core webapi how to disable CamelCase json result?

See original GitHub issue

i can not find AbpJson(...) in abpcontroller

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
malimingcommented, Jul 5, 2018

Customize here NamingStrategy = new CamelCaseNamingStrategy()

0reactions
LiuHui66commented, Mar 27, 2019

Abp中有没有更简单的

好的,我理解你的意思了,谢谢

return Json(new { allNodes = GetAllNodes() }, new JsonSerializerSettings() { ContractResolver = new AbpContractResolver { NamingStrategy = new DefaultNamingStrategy() } });

请问你最后是怎么加入这个逻辑的,不可能每次Return的时候都写这段吧?? 最后我把你的方法简单的封装了下 public JsonResult AbpJson(object data) { var serializerSettings = new JsonSerializerSettings() { ContractResolver = new AbpContractResolver { NamingStrategy = new DefaultNamingStrategy() } }; return base.Json(data, serializerSettings); } 有没有其他的方法

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with JSON serialization and camel casing in ASP.NET ...
As you can see, the code creates JsonSerializerOptions object and sets PropertyNamingPolicy property to JsonNamingPolicy.CamelCase. Then the ...
Read more >
ASPNet Core Changing the default Camel Case JSON ...
1. Open the Startup.cs class from the Solution Explorer window. · 2. Add the following namespace. · 3. Then inside the ConfigureServices method, ......
Read more >
Format response data in ASP.NET Core Web API
ASP.NET Core MVC supports formatting response data, using specified formats or in response to a client's request. Format-specific Action Results.
Read more >
ASP.NET Core - How to disable camel case serialization
Hi, I am using asp.net core dxDataGrid control. The field names in the results returned by the web api are lowered case at...
Read more >
How to serialize to JSON in camelCase using .NET Core?
This article describes how to configure your .NET Core application to serialize objects in camelCase instead of PascalCase. I guess this is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found