title: Extract value from json-array in ApacheCamel header
body: <p>I want to extract a value from a JSON-array inside a header using jsonpath.</p>
  
  <p>headers.barcodes:</p>
  
  <pre><code> [ { "barcodeValue" : "123456789" , "type" : "CODE128" , `"pageNumber" : 1}]
  </code></pre>
  
  <p>The only way I've found is to use the body to extract the value:</p>
  
  <pre><code>&lt;setBody&gt;
    &lt;simple&gt;${headers.barcodes}&lt;/simple&gt;
  &lt;/setBody&gt;
  &lt;setHeader headerName="barcodeValueOnly"&gt;
     &lt;jsonpath&gt;$[0].barcodeValue&lt;/jsonpath&gt;
  &lt;/setHeader&gt;
  </code></pre>
  
  <p>I have tried to pass the header like this:</p>
  
  <p><code>&lt;jsonpath&gt;${headers.barcodes}[0].barcodeValue&lt;/jsonpath&gt;</code></p>
  
  <p>but all I get is </p>
  
  <blockquote> com.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 2. Expected ?, ', 0-9, * </blockquote>
  
  <p>Is there any way to pass the header value directly to jsonpath without using the body?</p>