title: JMS Serializer deserialize nested objects
body: <p>I'm using: <a href="https://jmsyst.com/libs/serializer" rel="nofollow noreferrer">https://jmsyst.com/libs/serializer</a> </p>
  
  <p>For deserializing json objects. 
  Currently I have this:</p>
  
  <pre><code>/**
   * @param int $id
   * @return Customer
   * @throws \Http\Client\Exception
   */
  public function get(int $id): Customer
  {
      $response = $this-&gt;client-&gt;get('/customers/' . $id);
  
      $data = json_encode(json_decode(
          $response-&gt;getBody()-&gt;getContents()
      )-&gt;data-&gt;attributes);
  
      return $this
          -&gt;serializer
          -&gt;deserialize($data, Customer::class, 'json');
  }
  </code></pre>
  
  <p>The json that I receive here looks like this:</p>
  
  <pre><code>   {
      "data": {
              "type": "customer",
              "id": "4356456",
              "links": {
                      "self":"https:\/\/api.ecurring.com\/customers\/345656"
              },
              "attributes": {
                      "gender": "m",
              "first_name": "Laurens"
          }
      }
  </code></pre>
  
  <p>Is it possible to tell JMS it should automatically start from <code>data-&gt;attributes</code> instead of doing something dirty like this:</p>
  
  <pre><code> $data = json_encode(json_decode(
              $response-&gt;getBody()-&gt;getContents()
          )-&gt;data-&gt;attributes);
  </code></pre>