Avatar

Correct answer by
Community Advisor

Okay then I think there's something wrong with your API.

I think what is going on is that your API:

  1. Accepts JSON correctly.
  2. Stores the object correctly.
  3. Returns the JSON wrong.

I have the feeling your API might accept application/json but returns application/text or something like that, can you check?

Basically what should happen when you create a resource is that your API should return the same thing you sent to it, plus the ID of the created resource. For example:

Create a resource

POST /address

{"street": "this is a \" test"}

>>> {"id": "1", "street": "this is a \" test"}

Fetch a resource

GET /address/1

>>> {"id": "1", "street": "this is a \" test"}

Database content

id     street

-----  ----------------

1             this is a " test

View solution in original post