Serialize it
The ideal way is to use a serialization library, such as the one provided with NewtonSoft.Json:
var x = new { response = responseMessage, isNewAUser = isNewUser } ;
var s = JsonConvert.SerializeObject(x);
Console.WriteLine(s);
Output:
{"response":"Hello world!","isNewAUser":false}
Use string.Format:
If you insist on doing this with string manipulation, you can do it a few ways.
Normal string:
var template = "{{\"response\": \"{0}\",\"isNewAUser\": \"{1}\"}}";
var s = string.Format(template, responseMessage, isNewUser);
Console.WriteLine(s);
Or, using a verbatim string, which allows multiple lines:
var template = @"
{{
""response"": ""{0}"",
""isNewAUser"": ""{1}""
}}";
var s = string.Format(template, responseMessage, isNewUser);
Console.WriteLine(s);
Use an interpolated string
If you're on C#6 or later, you can use an interpolated string:
var s = $@"{{ ""response"" : ""{responseMessage}"",""isNewAUser"" : ""{isNewUser}""}}";
Console.WriteLine(s);
The double { is required in order to distinguish between placeholders and actual string literals, and the double " is required to escape the quote within the string.