REST Response adds \ - Media Type application/json vs text/plain

333 Views Asked by At

I have an endpoint that returns the following response,

curl -X 'POST' \
  'https://localhost:7135/api/v1/Initiate' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json'

returns

"{\"ID\":\"987139672\"}"

Notice the \ after key and value.

Vs.

curl -X 'POST' \
  'https://localhost:7135/api/v1/Initiate' \
  -H 'accept: text/plain' \
  -H 'Content-Type: application/json'

returns

{"ID":"987139673"}

Why is it happening?

0

There are 0 best solutions below