cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
asafweis
Resolver I
Resolver I

Google maps API and JSON format

Hi all,

 

I'm building a flow that sends an API request via HTTP GET to google's maps API in order to get a trip duration from one destination to another. 

 

Everything works so far, however when i get the response back  from google i get the JSON in a schema that doesn't seem to let me select the particular property that I'm after.

 

What I'm trying to isolate is the duration_in_traffic element from the JSON. Can anyone help me out with this? I've tried PARSE JSON without success.

 

Here is the output from the HTTP request:

 

{
  "destination_addresses": [
    "10 Walker St, Braeside VIC 3195, Australia"
  ],
  "origin_addresses": [
    "64 Cochranes Rd, Moorabbin VIC 3189, Australia"
  ],
  "rows": [
    {
      "elements": [
        {
          "distance": {
            "text""10.4 km",
            "value"10394
          },
          "duration": {
            "text""14 mins",
            "value"850
          },
          "duration_in_traffic": {
            "text""14 mins",
            "value"865
          },
          "status""OK"
        }
      ]
    }
  ],
  "status""OK"
}

 

How can i get the value of 14 mins?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User
Super User

Hi!

I would try withthe following WDL expression

 

first(first(body('HTTP')?['rows'])?['elements'])?['duration']?['text']

 

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

3 REPLIES 3
efialttes
Super User
Super User

Hi!

I would try withthe following WDL expression

 

first(first(body('HTTP')?['rows'])?['elements'])?['duration']?['text']

 

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Thank you!

Worked perfectly

Muito obrigado

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,838)