Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using Talend 7.3.1 for BigData Platform.
I have a rest service with request is Json format String (bookList with 2 books).
{ "bookList": [ {"onSale": false,"book": [ {"name":"book1","id":1}, {"name":"book2","id":2 } ] } ] }
What i want is : after running tExtractJsonFields, it should return an array of 2 elements: { "name": "book1", "id":1} and { "name": "book2", "id":2 }.
The jsonpath i used is $.bookList[*].book[*]. But What i have in tLogRow is only 1 string includes 2 elements. This is not what i want
.-------------------------------------------------.
| tLogRow_1 |
|=-----------------------------------------------=|
|single_book |
|=-----------------------------------------------=|
|[{"name":"book1","id":1},{"name":"book2","id":2}]|
'-------------------------------------------------'
Bellow is what i want to have. It should have 2 elements. Do you know how to do that?
.-------------------------------------------------.
| tLogRow_1 |
|=-----------------------------------------------=|
|single_book |
|=-----------------------------------------------=|
|{"name":"book1","id":1}
{"name":"book2","id":2}
'-------------------------------------------------'
Bellow is what I have with the Talend Job:
@Not defined Not defined , After tExtractJson use the tNormalize component and split based on }, then you will get two records and the use tMap if you want to remove any extra characters like [ or ] and check if you want to add any character if required like { or }
this is one way,since they are multiple ways.
Thanks,
Manohar