Hi,
In VB I use the following code to create a string with double-double quotes:
Dim jsonString As String = "{ ""id"": """ + drawingUID + """, ""fullPath"": """ + DestPathContractDB + """, ""link"": """ + LinkPath + """, ""scanFilename"": """ + txtCard.Text + ext + """ }"
This produces something like this in my application:
"{ ""id"": ""9999"", ""fullPath"": ""Z:\\AsBuiltDrawings\\OSHAWA\\OSH-00001.pdf"", ""link"": ""http://cctvweb/cctv/AsBuiltDrawings/OSHAWA/OSH-00001.pdf"", ""scanFilename"": ""OSH-00001.pdf"" }"
I need to convert this to C# code, but I am struggling to get the format of the double-double quotes to work. I have tried almost everything, but can't seem to get it correct. Using @, \, char.....this is driving me crazy. Here is my latest attempt:
string jsonString = "{ " + (char)34 + (char)34 + "id" + (char)34 + (char)34 + ": " + (char)34 + (char)34 + drawingUID + (char)34 + (char)34 + ", " + (char)34 + (char)34 + "fullPath" + (char)34 + (char)34 + ": " + (char)34 + (char)34 + destPath + (char)34 + (char)34 + ", " + (char)34 + (char)34 + "link" + (char)34 + (char)34 + ": " + (char)34 + (char)34 + linkPath + (char)34 + (char)34 + ", " + (char)34 + (char)34 + "scanFilename" + (char)34 + (char)34 + ": " + (char)34 + (char)34 + cardNum + ext + (char)34 + (char)34 + " }";
Which produces this:
"{ \"\"id\"\": \"\"9999\"\", \"\"fullPath\"\": \"\"Z:\\AsBuiltDrawings\\OSHAWA\\OSH-00001.pdf\"\", \"\"link\"\": \"\"http://cctvweb/cctv/AsBuiltDrawings/OSHAWA/OSH-00001.pdf\"\", \"\"scanFilename\"\": \"\"OSH-00001.pdf\"\" }"
Regardless of what I try I always end up getting the \"\" and not just ""
Any help is appreciated.
Thanks,