title: Dealing with a JObject vs a JArray
body: <p>I have a method which receives this parameter: </p>
  
  <pre><code>List&lt;QueueItem&gt; signups
  </code></pre>
  
  <p>This is the class:</p>
  
  <pre><code>public class QueueItem
  {
    public string Everything{ get; set; } //all the fields in one string 
  ...
  }
  </code></pre>
  
  <p>Everything has a string with all the fields from a Key Value pair object like this...</p>
  
  <pre class="lang-js prettyprint-override"><code>[{
    "Key": "Partner",
    "Value": "Place"
  }, {
    "Key": "FIRST_NAME",
    "Value": "John"
  }, {
    "Key": "last_name",
    "Value": "Smith"
  }]
  </code></pre>
  
  <p>But this line...</p>
  
  <pre><code>var result = signups.Select(x =&gt; JsonConvert.DeserializeObject&lt;JObject&gt;(x.Everything));
  </code></pre>
  
  <p>Comes back with this error message: </p>
  
  <p>"Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'Newtonsoft.Json.Linq.JObject'"</p>
  
  <p>The solution I've seen is to not cast to JObject and leave it as JArray but that would require changing the rest of the method which checks JObject specific stuff like Properties() etc. I would love to be able to deal with the json as a JObject and keep everything else as is. Is there an efficient way to do that?</p>
  
  <p>Because later I constantly check JObject specific properties like this...</p>
  
  <pre><code>var Properties = result.Select(x =&gt; x.Properties()).ToArray();
  </code></pre>