title: Serialize an IDictionary<string, object> with GraphQL and Hot Choclate to a dynamic JSON
body: <p>I'm adding Hot Chocolate(GraphQL) to an existing ASP.Net Core project with a Web API and reusing the models that are used by the Web API.
  One of the models has an IDictionary&lt;string, object&gt; property that is serialized into a dynamic JSON with Web API.</p>
  <p>The Model</p>
  <pre><code>public class Theme
  {
      ...
      public IDictionary&lt;string, object&gt; Styles { get; set; }
      ...
  }
  </code></pre>
  <p>that with the Web API can be serialized to</p>
  <pre><code>{
    ...
    styles: {
      header: {
        color: &quot;#fff&quot;, 
        background: &quot;rgba(255, 255, 255, 0)&quot;, 
        boxShadow: &quot;&quot;, position: &quot;fixed&quot;},
        ...
      },
      borderRadius: &quot;4px&quot;,
      ...
    }
    ...
  }
  </code></pre>
  <p>With Hot Chocolate, I'm reusing the model and adds GraphQL in startup with</p>
  <pre><code>services.AddGraphQL(sp =&gt; SchemaBuilder.New()
      .AddServices(sp)
      .AddQueryType(d =&gt; d.Name(&quot;Query&quot;))
      ...
      .AddType&lt;Theme&gt;()
      .Create());
  </code></pre>
  <p>The schema that is generated becomes</p>
  <pre><code>type Theme {
    ...
    styles: [KeyValuePairOfStringAndObject!]
    ...
  }
  </code></pre>
  <p>and only key can be retrieved</p>
  <pre><code>{
    themes(...) {
      edges {
        node {
          name
          styles{
            key
          }
        }
      }
    }
  }
  </code></pre>
  <p>with the following response</p>
  <pre><code>{
    &quot;themes&quot;: {
      &quot;edges&quot;: [
        {
          &quot;node&quot;: {
            ...
            &quot;styles&quot;: [
              {
                &quot;key&quot;: &quot;header&quot;
              },
              {
                &quot;key&quot;: &quot;borderRadius&quot;
              },
              ...
            ]
          }
        }
      ]
    }
  }
  </code></pre>
  <p>I would like to set up Hot Chocolate to make it possible to write a GraphQL query that gives the same dynamic result as the Web API.</p>
  <p><strong>UPDATE</strong></p>
  <p>The source is a JSON string that is deserialized to a Dictionary&lt;string, object&gt; with</p>
  <pre><code>var jsonString = &quot;{\&quot;header\&quot;:{\&quot;color\&quot;:\&quot;#fff\&quot;},\&quot;borderRadius\&quot;:\&quot;4px\&quot;}&quot;;
  
  theme.Styles = JsonConvert.DeserializeObject&lt;Dictionary&lt;string, object&gt;&gt;(jsonString);
  </code></pre>
  <p>The problem is that the resulting dictionary isn't recursively serialized to a Dictionary&lt;string, object&gt;.</p>