title: How to deserialize a KeyValuePair json array into a C# Class?
body: <p>I have a JSON string that looks like this:</p>
  <pre class="lang-json prettyprint-override"><code>{
     &quot;Attributes&quot;:[
        {
           &quot;Key&quot;:&quot;prop1&quot;,
           &quot;Value&quot;:&quot;prop1value&quot;
        },
        {
           &quot;Key&quot;:&quot;prop2&quot;,
           &quot;Value&quot;:{
              &quot;Id&quot;:&quot;30da85a5-682e-eb11-a813-000d3a4dade3&quot;,
              &quot;LogicalName&quot;:&quot;AnotherClass&quot;
           }
        },
        ...,
        {
           &quot;Key&quot;:&quot;propN&quot;,
           &quot;Value&quot;:&quot;propNvalue&quot;
        }
     ]
  }
  </code></pre>
  <p>I need to deserialize these keyvalue pairs into a class object like this:</p>
  <pre><code>public class MyClass
  {
      public string prop1 { get; set; }
      public AnotherClass prop2 { get; set; }
      ...
      public string propN { get; set; }
  }
  
  public class AnotherClass
  {
      public Guid Id { get; set; }
  }
  </code></pre>
  <p>Currently I'm looping through each kv pair and dynamically adding them to a new <code>JObject</code> then, deserializing that like this:</p>
  <pre><code>var _newJObject = new JObject();
  foreach (var att in Attributes)
  {
      _newJObject.Add(att.Key, att.Value);
  }
  var _myclass = _newJObject.ToObject&lt;MyClass&gt;();    
  </code></pre>
  <p>But is there a more direct way to accomplish this without manually creating the <code>_newJObject</code> intermediary?</p>