I have a document which has a field:
{
FOB: "..."
}
However when I return it:
[HttpGet("{documentRef}")]
public ActionResult<Ten> Get(string documentRef)
{
var data = _service.FindOneTen(documentRef);
if (data != null) return data;
Response.StatusCode = 400;
return NotFound();
}
It is converted to this:
{
fob: "..."
}
How can I stop this happening / Why is this happening?
I've seen examples of people using
PropertyNamingPolicy = null;
To disable it for MVC / the normal JSON which I tried and didn't work.
Startup:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddNewtonsoftJson();
}
Edit
While Objects exposed on JSON web-api - how to stop the property names changing case? is solving the problem in one way, I would rather not need to specify for every field in the model.