title: Dealing with multiple DTO's while making web client post request in spring Boot
body: <p>We have a body structure very similar to this :-</p>
  <p>{'a' : 'valueA1', 'b' : {'b1' : 'valueB1', 'b2' : 'valueB2'}}</p>
  <p>Now, we have a DTO for b which has b1 and b2.</p>
  <p>'''</p>
  <pre><code>public class B {
      private String b1;
      private String b2;
  }
  </code></pre>
  <p>'''
  And similarly we have a DTO for the whole structure, which has values String a and bDTO.</p>
  <p>'''</p>
  <pre><code>public class Z {
  private String a;
  private B b;
  }
  </code></pre>
  <p>'''
  We make their objects --</p>
  <p>B b = new B(&quot;valueB1&quot;, &quot;valueB2&quot;);
  Z z = new Z(&quot;valueA1&quot;, b);</p>
  <p>Now I want to make a webClient call using these DTOS.
  The way I am trying is :-</p>
  <p>'''</p>
  <pre><code>client1.post()
                      .uri(&quot;&quot;)
                      .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
                      .body(Mono.just(z), Z.class)
                      .retrieve().onStatus(HttpStatus::isError, response -&gt; response.bodyToMono(String.class).map(Exception::new))
                      .bodyToMono(Map.class).block();
  </code></pre>
  <p>'''</p>
  <p>When I send this request. The request received by the server is :-
  {'a' : 'valueA', 'b' : null}</p>
  <p>Please, Tell me a way to solve the problem</p>