title: Conditionally deserialize JSON string or array property to C# object using JSON.NET?
body: <p>I have a defined C# object based off a very complex JSON I'm getting from a third party API. Here's a piece of it: </p>
  
  <pre><code>{"alarmSummary":"NONE"}
  </code></pre>
  
  <p>The corresponding property in C# would be: </p>
  
  <pre><code>public string alarmSummary {get; set;}
  </code></pre>
  
  <p>And I would get this converted by using my typical JSONConvert from JSON.NET: </p>
  
  <pre><code>var alarms = JSONConvert.DeserializeObject&lt;MyClass&gt;(jsonString); 
  </code></pre>
  
  <p>However, the API will put alarms in this format, as an array, and "NONE" when there aren't any as a string: </p>
  
  <pre><code>{"alarmSummary" : ["AHHH Something went wrong!!", "I'm on fire!!"]}
  </code></pre>
  
  <p>Which means in C# it would need to be: </p>
  
  <pre><code>public string[] alarmSummary {get; set;}
  </code></pre>
  
  <p>If I could, I would just have the JSONConvert deserialize the "NONE" string into an array of just one entry. Is there a way to set conditions on this property, or will I have to take the whole complex JSON string and hand convert it? </p>