Lalitha Chevuru

Lalitha Chevuru

  • 1.6k
  • 84
  • 3.5k

Return multiline response in asp.net core API

Jul 7 2023 11:11 AM

Hi Team,

In my ASP.Net Core API, i want to return response in multiline, however it is returning in single line with \n\r.

I try to replace with Environment.Newline(), still not working.

Please help me to fix this issue.

my code:

throw new InvalidDataException("Field names are invalid.\n Field names should be either from Case or Charge.");

output:

{
  "error": {
    "data": 0,
    "message": "Field names are invalid.\r\n Field names should be either from Case or Charge."
  }
}

Thanks,

Lalitha.C


Answers (3)