0

I am trying to use the DataSnap REST server component in Delphi 10.2 Tokyo.

I met an issue when I sent the web response, indeed the browser is receiving a string (the JSON that I have sent) but it did not manage to see it as a "correct" JSON.

Here are some details of my code :

my server method returns a string (the JSON string)

in the webmodule I have added that in the procedure WebModuleBeforeDispatch:

Response.ContentType := 'application/json';

Is there a way to do send this "correct" JSON ?

Alec O
  • 1,697
  • 1
  • 18
  • 31
ALN Frs
  • 1
  • 2
  • Please describe what you mean by "correct" JSON. Not all browsers format JSON specially, but if you want it to be "pretty JSON" then you will need to install an add-on or copy/paste it into a converter online to better read it. – Alec O May 30 '17 at 17:34
  • Thank you for your answer. What I meant by a correct JSON is a string which represents my JSON but without the quotes. Indeed with the quotes the browsers do not manage to convert the JSON. What I am sending : "{"name" : "Roland", "id" : 1}" What I should send : {"name" : "Roland", "id" : 1} Thank you. – ALN Frs May 31 '17 at 00:40

0 Answers0