0

I have a POST Rest API which is receiving a json from body

controllerFunction([FromBody] JObject payload)

I am giving a json from postman which has a property called "Non­Critical_XYZ". When I am receiving the json in controller one extra "-" is getting added in JObject payload. The property is coming as "Non-Critical_XYZ". When I am taking the payload in excel it is showing like Special character 'Â' inserted for the property "NonÂCritical_XYZ".

Below are the headers I am sending with the request

enter image description here

dbc
  • 104,963
  • 20
  • 228
  • 340
Divya Vyas
  • 323
  • 1
  • 4
  • 16
  • And what is the problem? Can you show the code that creatres JObject or json? – Serge Sep 11 '22 at 18:43
  • Might you please [edit] your question to share a [mcve], specifically the RAW post headers + body? Chances are there is something wrong with the encoding in teh headers and/or the encoding is being interpreted incorrectly. – dbc Sep 11 '22 at 18:50
  • Perhaps the original JSON property name had a non-breaking space or other non-ASCII between `Non` and `Critical` and is getting messed up by a wrong encoding choice. For similar questions see [HTML encoding issues - "Â" character showing up instead of " "](https://stackoverflow.com/q/1461907), [Character Encoding: â?](https://stackoverflow.com/q/4547149), [How to convert ’ to apostrophe in C#?](https://stackoverflow.com/q/10888040), [why Special characters apostrophe and others shows like this ’, in HTMl file](https://stackoverflow.com/q/30739625) – dbc Sep 11 '22 at 18:58

0 Answers0