title: Apache Camel: I can't get an object out of the body and transform it
body: <p>Here is if do so: body -&gt; string -&gt; user</p>
  <pre class="lang-java prettyprint-override"><code>    .to(&quot;direct:httpClient&quot;)
      .process(new Processor() {
          @Override
          public void process(Exchange exchange) throws JsonProcessingException {
              String body = exchange.getIn().getBody(String.class);
              User[] users = jacksonDataFormat.getObjectMapper().readValue(body, User[].class);
          }
      })
  </code></pre>
  <p>This option works great, but if you do this:</p>
  <pre class="lang-java prettyprint-override"><code>User [] body = exchange.getIn().getBody(User[].class);
  </code></pre>
  <p>body -&gt; user, it doesn't work. User always null.</p>
  <p>For clarity:</p>
  <pre><code>from(&quot;timer://test?period=2000&quot;)
                  .setHeader(Exchange.HTTP_METHOD).constant(HttpMethod.GET)
                  .setHeader(Exchange.CONTENT_TYPE, constant(&quot;application/json&quot;))
                  .convertBodyTo(User[].class)
                  .to(&quot;http://localhost:8085/api/user&quot;)
                  .process(exchange -&gt; System.out.println(exchange.getIn().getBody(String.class)))
  </code></pre>
  <p>Console output:</p>
  <pre><code>[
     {
        &quot;name&quot;:&quot;BLA&quot;
     },
     {
        &quot;name&quot;:&quot;BLA&quot;
     },
     {
        &quot;name&quot;:&quot;BLA&quot;
     }
  ]
  </code></pre>
  <p>If so:</p>
  <pre><code>from(&quot;timer://test?period=2000&quot;)
                  .setHeader(Exchange.HTTP_METHOD).constant(HttpMethod.GET)
                  .setHeader(Exchange.CONTENT_TYPE, constant(&quot;application/json&quot;))
                  .convertBodyTo(User[].class)
                  .to(&quot;http://localhost:8085/api/user&quot;)
                  .process(exchange -&gt; System.out.println(exchange.getIn().getBody(User[].class)))
  </code></pre>
  <p>Console output: null</p>
  <p>What is the reason? how can I fix this?</p>