Working on a simple yelp REST API pull and parsing that to write to excel ultimately. In order to get there I was trying to traverse the JSON structure that seems to be built like an array.
This works:
jsonoutput.Item(“businesses”).ToString
but this gives me the entire node of business that seems like an array
This does not work
jsonoutput.Item(“businesses”)[0].“name”.ToString
update: Got it work after help from HareeshMR and some more trial and error. The type property for foreach activity needs to be JToken and then you can easily do item(“name”) to iterate through all business names.
Here is the gist of the JSON structure:
JSON structure
{
“businesses”: [
{
“id”: “YJoIaX8sd6fwYGSG4x4ZQQ”,
“alias”: “85-c-bakery-cafe-irvine”,
“name”: “85°C Bakery Cafe”,
“image_url”: “https://s3-media4.fl.yelpcdn.com/bphoto/Hpoz4d59tOX62c1OczGVAg/o.jpg”,
“is_closed”: false,
“url”: “https://www.yelp.com/biz/85-c-bakery-cafe-irvine?adjust_creative=6SOYGhGW1utOGPKrF0vMHA&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=6SOYGhGW1utOGPKrF0vMHA”,
“review_count”: 5590,
“categories”: [
{
“alias”: “coffee”,
“title”: “Coffee & Tea”
},
{
“alias”: “bakeries”,
“title”: “Bakeries”
},
{
“alias”: “cakeshop”,
“title”: “Patisserie/Cake Shop”
}
],
“rating”: 4,
“coordinates”: {
“latitude”: 33.6880095831667,
“longitude”: -117.834029372422
},
“transactions”: ,
“price”: “$”,
“location”: {
“address1”: “2700 Alton Pkwy”,
“address2”: “Ste 123”,
“address3”: “”,
“city”: “Irvine”,
“zip_code”: “92606”,
“country”: “US”,
“state”: “CA”,
“display_address”: [
“2700 Alton Pkwy”,
“Ste 123”,
“Irvine, CA 92606”
]
},
“phone”: “+19495538585”,
“display_phone”: “(949) 553-8585”,
“distance”: 3906.72270180294
},
{
“id”: “NVB2X8t5Rie8S5AnzOnWJg”,
“alias”: “north-italia-irvine”,
“name”: “North Italia”,
“image_url”: “https://s3-media2.fl.yelpcdn.com/bphoto/TWL29M9UmLCIE1BZrXni8A/o.jpg”,
“is_closed”: false,
“url”: “https://www.yelp.com/biz/north-italia-irvine?adjust_creative=6SOYGhGW1utOGPKrF0vMHA&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=6SOYGhGW1utOGPKrF0vMHA”,
“review_count”: 2770,
“categories”: [
{
“alias”: “pizza”,
“title”: “Pizza”
},
{
“alias”: “italian”,
“title”: “Italian”
}
],
“rating”: 4.5,
“coordinates”: {
“latitude”: 33.67179,
“longitude”: -117.84507
},
“transactions”: ,
“price”: “$$”,
“location”: {
“address1”: “2957 Michelson Dr”,
“address2”: “”,
“address3”: “”,
“city”: “Irvine”,
“zip_code”: “92612”,
“country”: “US”,
“state”: “CA”,
“display_address”: [
“2957 Michelson Dr”,
“Irvine, CA 92612”
]
},
“phone”: “+19496297060”,
“display_phone”: “(949) 629-7060”,
“distance”: 4841.642780366079
}
],
“total”: 8200,
“region”: {
“center”: {
“longitude”: -117.79335021972656,
“latitude”: 33.67859713176237
}
}
}
Main.xaml (7.9 KB)