title: Serialize a Json property that is sometimes an array
body: <p>Is there any way to serialize a Json object property that varies from decimal to decimal[] in a single operation?</p>
  
  <p>In my Json product feed special offer items are represented as an array (normal price/ sale price).  Normal items are just the price.  Like so:</p>
  
  <pre><code>[
      {
          "product" : "umbrella",
          "price" : 10.50,
      },
          "product" : "chainsaw",
          "price" : [
                        39.99,
                        20.0
                      ]
      }
  ]
  </code></pre>
  
  <p>The only way I can get it to work is if I make the property an object like so:</p>
  
  <pre><code>public class Product
  {
      public string product { get; set; }
      public object price { get; set; }
  }
  
  var productList = JsonConvert.DeserializeObject&lt;List&lt;Product&gt;&gt;(jsonArray);
  </code></pre>
  
  <p>But if I try to make it decimal[] then it will throw exception on a single decimal value.  Making it an object means that the arrays values are a JArray so I have to do some clean up work afterwards and other mapping in my application requires the property type to be accurate so I have to map this to an unmapped property then initialize another property which is no big deal but a little messy with naming.</p>
  
  <p>Is object the only option here or is there some magic I can do with the serializer that either adds single value to array or the second value to a separate property for special offer price?</p>