title: How to handle both a single item and an array for the same property using JSON.net
body: <p>I'm trying to fix my SendGridPlus library to deal with SendGrid events, but I'm having some trouble with the inconsistent treatment of categories in the API.</p>
  <p>In the following example payload taken from the <a href="http://sendgrid.com/docs/API_Reference/Webhooks/event.html#-Event-POST-Example" rel="noreferrer">SendGrid API reference</a>, you'll notice that the <code>category</code> property for each item can either be a single string or an array of strings.</p>
  <pre class="lang-json prettyprint-override"><code>[
    {
      &quot;email&quot;: &quot;john.doe@sendgrid.com&quot;,
      &quot;timestamp&quot;: 1337966815,
      &quot;category&quot;: [
        &quot;newuser&quot;,
        &quot;transactional&quot;
      ],
      &quot;event&quot;: &quot;open&quot;
    },
    {
      &quot;email&quot;: &quot;jane.doe@sendgrid.com&quot;,
      &quot;timestamp&quot;: 1337966815,
      &quot;category&quot;: &quot;olduser&quot;,
      &quot;event&quot;: &quot;open&quot;
    }
  ]
  </code></pre>
  <p>It seems my options to make JSON.NET like this are fixing the string before it comes in, or configuring JSON.NET to accept the incorrect data. I'd rather not do any string parsing if I can get away with it.</p>
  <p>Is there any other way I can handle this using Json.Net?</p>