0

Consider following piece of some controller's code:

return Json(Result.Succeed());

Output it produces is { "Success": true }, because underlying model property is declared as bool Sucess (uppercase). I'd like Json(...) to spit out camelCaseFormatted json as it is conventional in the js/typescript world.

So even tought model's property is Success, I'd like respond to be success.

How can I configure that one?

Zazaeil
  • 3,900
  • 2
  • 14
  • 31
  • Possible duplicate of [Web API 2: how to return JSON with camelCased property names, on objects and their sub-objects](https://stackoverflow.com/questions/28552567/web-api-2-how-to-return-json-with-camelcased-property-names-on-objects-and-the) – Nkosi Sep 20 '18 at 22:48

1 Answers1

1

Try setting the JsonProperty attribute on model property as follows:

[JsonProperty("success")] public bool Success { get; set; }

Rahul Salvi
  • 364
  • 3
  • 13