title: Deserialize JSON with square brackets around string values
body: <p>I receive the following JSON from a Web API that lists the errors that were found in a POST. There can be more than one key-value pair in <code>ModelState</code>, depending how many errors were found. The only problem is that there are square brackets around the values. So when I deserialize with JSON.net there is an <code>Unexpected token</code> error.</p>
  
  <p>My solution now is to do a search and replace for those brackets and then deserialize, which does work. But is there a better solution?</p>
  
  <p><strong>My class</strong></p>
  
  <pre><code>public class Error
  {
      public string Message { get; set; }
      public Dictionary&lt;string, string&gt; ModelState { get; set; }
  }
  </code></pre>
  
  <p><strong>The JSON</strong></p>
  
  <pre><code>{
      "Message": "The request is invalid.",
      "ModelState": {
          "member.Gender": ["An error has occurred."],
          "member.MemberID": ["The MemberID field is required."],
          "member.BoardMemberID": ["The BoardMemberID field is required."],
      }
  }
  </code></pre>
  
  <p><strong>How I deserialize now</strong></p>
  
  <pre><code>Error error = JsonConvert.DeserializeObject&lt;Error&gt;(jsonString.Replace("[", "").Replace("]", ""));
  </code></pre>