title: How to map values from nested dict to Pydantic Model?
body: <p>I am trying to map a value from a nested dict/json to my Pydantic model. For me, this works well when my json/dict has a flat structure. However, I am struggling to map values from a nested structure to my Pydantic Model.</p>
  <p>Lets assume I have a json/dict in the following format:</p>
  <pre><code>d = {
  &quot;p_id&quot;: 1,
  &quot;billing&quot;: {
      &quot;first_name&quot;: &quot;test&quot;
  }
  </code></pre>
  <p>In addition, I have a Pydantic model with two attributes:</p>
  <pre><code>class Order(BaseModel):
      p_id: int
      pre_name: str
  </code></pre>
  <p>How can I map the value from the key <code>first_name</code>to my Pydantic attribute <code>pre_name</code>?</p>
  <p>Is there an easy way instead of using a <code>root_validator</code> to parse the given structure to my flat pydantic Model?</p>