title: intercept JSON in C# to return a list of nullable boolean
body: <p>I am getting an error when I try to return a list of nullable boolean from my JSON interceptor.
  The interceptor attribute is:</p>
  
  <pre><code>[JsonConverter(typeof(NullableBoolListDeSerializer))]
  public List&lt;bool?&gt; ExemptBenefits { get; set; }
  </code></pre>
  
  <p>The ReadJSON method on the interceptor is:</p>
  
  <pre><code> List&lt;bool?&gt; result = new List&lt;bool?&gt;();
  
          (reader as Newtonsoft.Json.Linq.JTokenReader).CurrentToken.ToList().ForEach(item =&gt;
          {
              string value = (String)item.ToObject(typeof(String));
              switch (value.ToLower())
              {
                  case "true":
                  case "yes":
                  case "1":
                      result.Add(true);
                      break;
                  case "false":
                  case "no":
                  case "0":
                  default:
                      result.Add(false);
                      break;
              }
          });
          return result;
  </code></pre>
  
  <p>The JSON being submitted is:</p>
  
  <pre><code>{
    "exemptBenefits": [
       "1"
    ],
    "_apiEndpoint": "/benefits/loan"
  }
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <pre><code>Unexpected token when deserializing object: String. Path 'exemptBenefits[0]', line 1, position 187.
  </code></pre>
  
  <p>Wondering how to convert a list of strings (eg "1","0"."true", "false") from JSON to a List (true,false,true,false) in a JSON interceptor 
  (actually it is NewtonSoft.Json)</p>