Is there a way to disable camel case serialization for a specific controller or action in core? I'm aware it can be set across all controllers in the Startup file with something like this:

    .AddJsonOptions(opt => opt.SerializerSettings.ContractResolver
        = new DefaultContractResolver());

but that's not what I'm looking for.

I'm looking for something like a custom attribute solution like this: but for .net core.

Any help would be greatly appreciated. Thank you.

1 Answer 1

You can use the Json helper method, which accepts a JsonSerializerSettings as second parameter

public IActionResult Get() 
    return Json(new { Value = "Test" }, new JsonSerializerSettings