currently I am extracting data from the Facebook Marketing API. I am Using an XPATH query in Talend Studio for the JSON i get via the API.
Since this is my first Job with JSON and XPATH I need some help with the following extraction:
At first a part of my JSON:
{
"data": [
{
.
.
.
"adsets": {
"data": [
{
.
.
.
"targeting": {
"age_max": 60,
"age_min": 18,
"geo_locations": {
"countries": [
"DE"
]
},
"facebook_positions": [
"feed",
"right_hand_column"
],
.
.
.
Now i want to extract from "facebook_positions" with XPATH:
"/data/adsets/data/targeting/facebook_positions"
with that XPATH query I only get "feed" as my result but I need "feed,right_hand_column" since there are no keys to the values like ' "age_max": 60' I am not able to extract the correct path.
Thanks in advance for your help!
Best Regards CoGe
Have you tried :-
//facebook_positions
OR
//facebook_positions[1]
-> feed
//facebook_positions[2]
-> right_hand_column
Example :-
Open below URL:
{
"data": [{
"adsets": {
"data": [{
"targeting": {
"age_max": 60,
"age_min": 18,
"geo_locations": {
"countries": [
"DE"
]
},
"facebook_positions": [
"feed",
"right_hand_column"
]
}
}]
}
}]
}
Select Query for JSON as :-
Xpath for JSon
put the query as :-
//facebook_positions
Click on Run
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.