How can i create a json variable direct from the code

I have tried
string json="{
“name”: “Demo incident create”,
“started_at”: “06:22 UTC on 21 May 2021”,
“contract_ids”: ["

contract ids


incident ids



severity ids


Also tried

  • replacing " with “” and an @ sign in the starting,

  • replacing " with /"
    but nothing seems to work

Share the code in a text file
What are the names of variable used and their data types?

Can you tell me how to save json format in a string variable? That will make that code work.

The above code is not clear. Is there any variable used


"{""name"": ""Demo incident create"",""started_at"": ""06:22 UTC on 21 May 2021"",""contract_ids"": [""contract ids""], ""incident_type_id"": ""incident ids"", ""severity_id"": ""severity ids""}"

Yes sorry to mention it so late. I do want to add a variable value in started_at and same for the name

"{""name"": """+nameVariable.ToString+""",""started_at"": """+startedAtVariable.ToString+""",""contract_ids"": [""contract ids""], ""incident_type_id"": ""incident ids"", ""severity_id"": ""severity ids""}"

In this video I show how to build JSON from code very fast: