Put string into Json

I have a JSON as:
“{”“incident”" : 123, ““text””: “”" + VAR + “”", ““entry type””:1}"

VAR=“abc “payment” def”

When I pass the VAR into JSON and do Http request - I receive an error from API. It seems to be because of quotes before and after “payment”.
Also, I tried to hardcode VAR into the JSON but have a problem with syntax.

Need help with this issue. Thanks.

Hi Slavich,
the quotes (and other special chars) of your variable have to be escaped so it does not clash with the JSON-format.

Do something like this:
“{”“incident”" : 123, ““text””: " + Newtonsoft.Json.JsonConvert.SerializeObject(VAR) + “, ““entry type””:1}”

Or create a JSON-Object instead of a string :wink:

2 Likes

I tried as you mentioned but receive:
{“incident” : 123, “text”: ““abc “payment” def””, “entry type”:1} - the ‘’ symbols are not accepted by api call.
So how can I create a Json object?