I am converting DataSet to JSon using this code.
JObject jsonObject = new JObject();
string jsonString = string.Empty;
JsonSerializerSettings jsonSettings = new JsonSerializerSettings();
jsonSettings.StringEscapeHandling = StringEscapeHandling.EscapeHtml;
jsonString = JsonConvert.SerializeObject(dsResults, jsonSettings);
jsonObject = JObject.Parse(jsonString);
if (!string.IsNullOrEmpty(identifier))
   jsonObject.AddFirst(new JProperty("identifier", identifier));
if (!string.IsNullOrEmpty(resourceType))
   jsonObject.AddFirst(new JProperty("resourceType", resourceType));
if (!string.IsNullOrEmpty(patientId))
{
   jsonObject.AddFirst(new JProperty("patientId", patientId));
   jsonObject.AddFirst(new JProperty("status", "'{success: true}'")); 
}
jsonString = jsonObject.ToString();
And, it is giving me output (appending Dataset name and all the things within quotes) as;
{
  "TableName": [
    {
       "status": "{success: true}",
       "softwareName": "MY Software",
       "softwareVersion": "0.4.5.9",
       "TimeZone": "(UTC+12:00) City, Country"      
    }
  ]
}
But, I want output like this
{
   status: {success: true},
   softwareName: "My Software ",
   softwareVersion: "0.4.5.9",
   TimeZone: (UTC+12:00) City, Country
}
What is problem in above code or what modifications can I do? I don’t want to achieve my results with jsonString.Replace("","") or indexing approach.
 
     
    