title: How to marshal JSON with repeating groups in a fixed length data format in java using camel?
body: <p>I need to process a JSON - it has repeating groups
  I need to convert it to fixed length record</p>
  <pre><code>{
      &quot;blockType&quot; : &quot;BL-H &quot;,
      &quot;blockTypeLength&quot; : &quot;00000031&quot;,
      &quot;blockId&quot; : &quot;S62951156229900&quot;,
      &quot;totalNoOfTX&quot; : &quot;001&quot;,
      &quot;msgblockType&quot; : &quot;TX-S &quot;,
      &quot;messageLength&quot; : &quot;00000728&quot;,
      &quot;noa&quot;:[
          {
              &quot;title&quot;:&quot;Behin&quot;,
              &quot;artist&quot;:&quot;LIMP &quot;,
              &quot;itunes_link&quot;:&quot;http:behind&quot;
          },
          {
              &quot;title&quot;:&quot;Alone&quot;,
              &quot;artist&quot;:&quot;ALYSS&quot;,
              &quot;itunes_link&quot;:&quot;http:clk.doubler.com&quot;
          }
      ]
  
  }
  </code></pre>
  <p>Should be converted to BehinLIMP http:behindAloneALYSShttp:clk.doubler.com</p>
  <p>I can have one to many such groups in the request</p>
  <p>What I have tried -</p>
  <pre><code>DataFormat bindy = new BindyFixedLengthDataFormat(myModel.class);
  
                  from(&quot;direct:testUnmarshall&quot;)
              .log(&quot;${body}&quot;)
              //.unmarshal().json(JsonLibrary.Jackson, BillingBookingRequest[].class)
              .inputType(BillingBookingRequest.class)
              .process(new Processor() {
                  @Override
                  public void process(Exchange exchange) throws Exception {
  
                      try {
                          BillingBookingRequest responseBody = exchange.getMessage().getBody(BillingBookingRequest.class);
  
                          ZvkkRequest requestBody = new ZvkkRequest();
                          requestBody.setBlockType(responseBody.getBlockType());
                          requestBody.setBlockTypeLength(responseBody.getBlockTypeLength());
                          requestBody.setBlockId(responseBody.getBlockId());
                          requestBody.setTotalNoOfTX(responseBody.getTotalNoOfTX());
                          requestBody.setMsgblockType(responseBody.getMsgblockType());
                          requestBody.setMessageLength(responseBody.getMessageLength());
  
                          List&lt;DAO&gt; noaList = responseBody.getNoa();
                          List&lt;DAOFix&gt; repGrp = new ArrayList&lt;&gt;();
  
                          for (DAO noa:
                               noaList) {
                              DAOFix obj = new DAOFix();
                              obj.setArtist(noa.getArtist());obj.setTitle(noa.getTitle());obj.setItunes_link(noa.getItunes_link());
                              repGrp.add(obj);
                          }
  
                          requestBody.setRepeatingGrp(repGrp);
                          exchange.getOut().setBody(requestBody);
                      } catch (Exception exception){
                          System.out.println(&quot;EXCEPTION HERE :: &quot;+exception.getMessage());
                          exception.printStackTrace();
                      }
  
                  }
              })
              .log(&quot;Before marshal ....... ${body}&quot;)
              .marshal(bindy)
              .log(&quot;After marshal ....... ${body}&quot;)
              .to(&quot;{{file.path}}fileName=check.dat&quot;)
              .end();
  </code></pre>
  <pre><code>java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
  also observed - org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: myFixedLengthRequestModel to the required type: java.io.InputStream with value myFixedLengthRequestModel[with all the values]
  </code></pre>
  <p>I have used the corresponding models holding the values for json as well as @FixedLengthRecord
  need help to understand and get this resolved.</p>
  <pre><code>public class ZvkkRequest {
  @DataField(pos = 1, length=5, align = &quot;L&quot;, paddingChar=' ')
  private String blockType;
  @DataField(pos = 2, length=8, align = &quot;R&quot;, paddingChar='0')
  private int blockTypeLength;
  @DataField(pos = 3, length=15, align = &quot;L&quot;, paddingChar=' ')
  private String blockId;
  @DataField(pos = 4, length=3, align = &quot;R&quot;, paddingChar='0')
  private int totalNoOfTX;
  @DataField(pos = 5, length=5, align = &quot;L&quot;, paddingChar=' ')
  private String msgblockType;
  @DataField(pos = 6, length=8, align = &quot;R&quot;, paddingChar='0')
  private int messageLength;
  
  @OneToMany(mappedTo = &quot;classpath.DAOFix&quot;)
  private List&lt;DAOFix&gt; repeatingGrp;
  }
  
  class DAOFix {
  
  @DataField(pos = 7, length=5, align = &quot;R&quot;, paddingChar=' ')
  private String title;
  @DataField(pos = 8, length=5, align = &quot;R&quot;, paddingChar=' ')
  private String artist;
  @DataField(pos = 9, length=5, align = &quot;R&quot;, paddingChar=' ')
  private String itunes_link;
  </code></pre>
  <p>}</p>