title: Converting dynamic element string in JSON into a class
body: <p>I could not find a question that deals with what I am about to ask so I went ahead and created this question.</p>
  
  <p>I have a json coming back to me from our UI and I can convert that to an object without any issues until I hit this line:</p>
  
  <pre><code>\"lang\":{\"en-US\":{\"name\":\"AS Test Assembly Activity\",\"description\":\"Activity to test assembly activities\"}}
  </code></pre>
  
  <p>My problem is the "en-US" it appears it would be a class with fields of 'name' and 'description'. How can I safely convert the "en-US" to an object? This can be dynamic and will be whatever the culture code is set too.</p>
  
  <p>I was able to get it converted by changing it to this:</p>
  
  <pre><code>\"lang\":{\"culture\":\"en-US\",\"name\":\"AS Test Assembly Activity\",\"description\":\"Activity to test assembly activities\"}}
  </code></pre>
  
  <p>But now the UI is stating they could use this, but prefer it to be inline with the original json. </p>
  
  <p>Any thoughts?</p>
  
  <p>Thanks</p>
  
  <p>Edit: (What so I mean 'convert "en-US" to a class?)</p>
  
  <p>when I convert this to a class it should look simliar to this:</p>
  
  <pre><code>public class CustomActivityLanguageData
  {
      public string Name { get; set; }
      public string Description { get; set; }
      public string Culture { get; set; }
  }
  </code></pre>
  
  <p>But the Culture was added for the 'fix' I put in above. On the original json I posted, it looks like "en-US" would be a class in the same way that the 'CustomActivityLanguageData' class in code above is a class (btw 'CustomActivityLanguageData' == 'lang' in json)</p>
  
  <p>It appears "en-US" has fields attached to it, like a class but it won't convert.</p>
  
  <p>Double Edit: To further expound on this, it appears this is what the class would ultimately look like:</p>
  
  <pre><code>public class Lang
  {
      en-US cultureCode {get;set;}
  }
  
  public class en-US
  {
      public string name {get;set;}
      public string description {get;set;}
  }
  </code></pre>
  
  <p>Hope that explains a little better.</p>