title: How to escape especial characters in JSON
body: <p>I need to bind the JSON object to model classes. To achieve that I used following code lines. </p>
  
  <p>My tested JSON as follows</p>
  
  <pre><code>{  
     "Message":null,
     "Error":false,
     "VData":{  
        "RNumber":null,
        "BRNumber":"Session1"
     },
     "onlineFields":{  
        "CCode":"Web",
        "MNumber":"15478655",
        "Product":"100",
        "JsonFile":{  
           "evaluation":{  
              "number":[  
                 {  
                    "@paraID":"1000",
                    "@Value":"",
                    "@label":"We are america"
                 },
                 {  
                    "@paraID":"2000",
                    "@Value":"100",
                    "@label":"We are japan"
                 },
                 {  
                    "@paraID":"3000",
                    "@Value":"1000",
                    "@label":"We are UK"
                 },
                 {  
                    "@paraID":"4000",
                    "@Value":"",
                    "@label":"We are China"
                 }
              ]
           }
        }
     }
  }
  </code></pre>
  
  <p>and this is my model classes.</p>
  
  <pre><code>public class VData
  {
      public object RNumber { get; set; }
      public string BRNumber { get; set; }
  }
  
  public class Number
  {
      [JsonProperty("@paraID")]
      public string paraID { get; set; }
      [JsonProperty("@Value")]
      public string Value { get; set; }
      [JsonProperty("@label")]
      public string label { get; set; }
  }
  
  public class Evaluation
  {
      public List&lt;Number&gt; number { get; set; }
  }
  
  public class JsonFile
  {
      public Evaluation evaluation { get; set; }
  }
  
  public class OnlineFields
  {
      public string CCode { get; set; }
      public string MNumber { get; set; }
      public string Product { get; set; }
      public JsonFile JsonFile { get; set; }
  }
  
  public class Response
  {
      public object Message { get; set; }
      public bool Error { get; set; }
      public VData VData { get; set; }
      public OnlineFields onlineFields { get; set; }
  }
  </code></pre>
  
  <p>To set the above JSON to my model, I used the following code</p>
  
  <pre><code>private static void showJSON(string testJson){
  
      Response response = JsonConvert.DeserializeObject&lt;Response&gt;(testJson);
  
      var dropdowns = response.OnlineFields.JsonFile;
  
      string json = JsonConvert.SerializeObject(dropdowns, Newtonsoft.Json.Formatting.Indented);
  
      Console.WriteLine(json);
  }
  </code></pre>
  
  <p>This working fine. but the problem is my client sends me the following JSON through the API.</p>
  
  <pre><code>{  
     "Message":null,
     "Error":false,
     "VData":{  
        "RNumber":null,
        "BRNumber":"Session1"
     },
     "onlineFields":{  
        "CCode":"Web",
        "MNumber":"15478655",
        "Product":"100",
        "JsonFile":"      {  
           \"evaluation\":{  
              \"number\":[  
                 {  
                    \"@paraID\":\"1000\",
                    \"@Value\":\"\",
                    \"@label\":\"We are america\"
                 },
                 {  
                    \"@paraID\":\"2000\",
                    \"@Value\":\"100\",
                    \"@label\":\"We are japan\"
                 },
                 {  
                    \"@paraID\":\"3000\",
                    \"@Value\":\"1000\",
                    \"@label\":\"We are UK\"
                 },
                 {  
                    \"@paraID\":\"4000\",
                    \"@Value\":\"\",
                    \"@label\":\"We are China\"
                 }
              ]
           }
        } "     
     }
  }
  </code></pre>
  
  <p>So how to escape this "<code>\</code>" characters and how to bind the client sent JSON to my model. In the client's JSON have inner JSON called JsonFile. This inner JSON consists with "<code>\</code>" and inner JSON consists within quotation <code>""</code>. So please give me a solution. </p>
  
  <p><strong>Updated:</strong></p>
  
  <p>According to <a href="https://stackoverflow.com/questions/39154043/how-do-i-convert-an-escaped-json-string-within-a-json-object/">this</a> post. I have tried this. but this makes me errors. So please give me a solution. In order to that post or any other way how to solve this</p>
  
  <pre><code>dynamic obj = JsonConvert.DeserializeObject(json);
  foreach (var response in (IEnumerable&lt;dynamic&gt;)obj.onlineFields)
  {
      response.onlineFields.JsonFile = JsonConvert.DeserializeObject((string)response.onlineFields.JsonFile);
  }
  string result = JsonConvert.SerializeObject(obj);
  
  Console.WriteLine(result); 
  </code></pre>