How to process JSON using Talend which is dynamic in nature?
===

The JSON response from the web service may vary. Following is the sample JSON which I need to process:

1.
    [{"Header":[{"h1":"some text","h2":"some other text","h3":"something"}]},
    {"Details":[{"d1":"details","d2":"blah blah"},{"d1":"blah","d2":"blah"}]},
    {"comments":[{"c1":"comment 1"},{"c1":"comment 2"}]}]


2.
    [{"Header":[{"h1":"some text","h2":"some other text","h3":"something"}]},
    {"Details":[{"d1":"details","d2":"blah blah"}]},
    {"Comments":[{"c1":"comment 1"}]}]

From the above sample responses, you may notice that the number of Details & Comments may vary in JSON response. I need to parse this JSON and write it in to a file. Where each response will have exactly one header and zero or more details and comments. Each one of this has to be treated as a record in file. So for the first JSON response there will be 4 records (header - 1, details - 2 & comments - 1). And for the second there will be three records (header - 1, details - 1 & comments - 1).

Thanks in advance.
 