Select to view content in your preferred language

Use Arcade to return the first result from a URL (waze reverse geocode)

707
4
Jump to solution
04-19-2023 11:01 AM
Labels (3)
daniel_marincounty
New Contributor II

I'm trying to use the Waze reverse geocoding API to return the first Street name from the results. 

The URL looks like this: 

  1. https://www.waze.com/partnerhub-api/waze-map/streetsInfo?lat=<lat>&lon=<lon>&token=<token>

 

I'm able to build a URL that users can click on in the pop-up to view the results. However, I'd really like for it to just return the first resulting Street Name in the field rather than a URL. Does anyone have any ideas on how to accomplish this?

 

Thank you!

 

daniel_marincounty_0-1681927286540.png

 

 

0 Kudos
1 Solution

Accepted Solutions
JoshuaSharp-Heward
Occasional Contributor III

Hi Daniel,

There's an arcade function called "FromJSON" which will turn the data into the relevant arcade data type, in this case a dictionary. I think that should do what you need!

View solution in original post

4 Replies
JoshuaSharp-Heward
Occasional Contributor III

Hi Daniel,

You should be able to just take the json that's shown in your screenshot, grab the "results" and take the first result in the list doing something like this:

JoshuaSharpHeward_3-1681982829659.png

Just un-nesting the json response essentially.

Josh

0 Kudos
daniel_marincounty
New Contributor II

Thank you for your response. next to result I put 'https://www.waze.com/partnerhub-api/waze-map/streetsInfo?lat=%3Clat%3E&lon=%3Clon%3E&token=%3Ctoken%... (with the lat,long, and token) and I get the response that it cannot access the value using a key of this type. Is there a way to parse the JSON Response in the script? 

0 Kudos
JoshuaSharp-Heward
Occasional Contributor III

Hi Daniel,

There's an arcade function called "FromJSON" which will turn the data into the relevant arcade data type, in this case a dictionary. I think that should do what you need!

daniel_marincounty
New Contributor II

I am going to give that a try. It looks like parsing a JSON response it's available right now, but it's under consideration.  I was hoping to be able to do it on the fly but I'm just going to hard code it in the table using Python. 

Thank you for your help! 

0 Kudos