skip to Main Content

I have the Below JSON Result.

"{""head"":{""clientID"":""100088optimumremit"",""reqTime"":""2022-01-20T15:06:58+08:00"",""reqMsgID"":""GcashValidate85"",""clientSecret"":""100088optimumremit""},""body"":{""merchantID"":""100088"",""codeString"":""123456"",""codeType"":""REFERENCE_CODE""}}"  

What I want is the below Result

"{"head":{"clientID":"100088optimumremit","reqTime":"2022-01-20T15:06:58+08:00","reqMsgID":"GcashValidate85","clientSecret":"100088optimumremit"},"body":{"merchantID":"100088","codeString":"123456","codeType":"REFERENCE_CODE"}}"  

How do I attain the single quote (") only?

2

Answers


  1. var json = @"{""head"":{""clientID"":""100088optimumremit"",""reqTime"":""2022-01-20T15:06:58+08:00"",""reqMsgID"":""GcashValidate85"",""clientSecret"":""100088optimumremit""},""body"":{""merchantID"":""100088"",""codeString"":""123456"",""codeType"":""REFERENCE_CODE""}}";
    var cleanJson = json.Replace("""", """);
    Console.WriteLine(cleanJson);
    
    Login or Signup to reply.
  2. Generally, You can do regular expression to replace all double quote with single double quote.

    You can use json.Replace("""", """)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search