Venkat Kumar

Venkat Kumar

  • NA
  • 503
  • 140.5k

How to assign string that contains double quotes(")

May 10 2019 5:36 AM
Hi,
 
I'm working on webapi project there I'm facing an issue to display the same data that is in Database.
 
For Example: Data Exist in Database is Sai"Pradeep
 
  1. Result objResult = new Result();  
  2. List<Result> lObj = new List<Result>();   
  3. objResult.Description = "Sai\"Pradeep";  
  4. lObj.Add(objResult);   
 
As per the above code I'm getting below output. My focus is on the data in Description field.
      {
"results":[
               {
               "Description" : "Sai\"Pradeep"
               }
               ]
       } 
 
My Expectation is
{
"Descripton" : "Sai"Pradeep"
}
I tried using Replace also but none of them works out to me. 
 
When I run in Console project using below code it is working as I expected.
  1. string desc="Sai\"Pradeep";  
  2. Console.WriteLine(desc);   
 
Output: Sai"Pradeep 
 
It would be great if anyone can help me out in this scenerio.

Answers (1)