I create a job in Talend to extract data from an API to MySQL table. I used tRest as input(data pull), and tLogRow for now to view it in table form.
I lost it at mapping the json response into column for each of the field and value.
but the response was in one string line, when it's prettier formatted:
{
"data":
{
"user":
[
{"id":8, "name":"Alex"},
{"id":9, "name":"John"}
]
},
"http_code":200,
"message":[]
}
how can I turn this response and map into table like below
id | name |
---|---|
8 | Alex |
9 | John |
Glad if you guys have the working example too. Or using different components might help?
CodePudding user response:
Here's how to set up tExtractJSONFields:
Loop path query needs to be:
$.data.user[*]
And just use the attribute names as json query for for each column.
The output:
.-- ----.
|tLogRow_1|
|=- ---=|
|id|name|
|=- ---=|
|8 |Alex|
|9 |John|
'-- ----'