cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
asafweis
Helper I
Helper 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 III
Super User III

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

2 REPLIES 2
efialttes
Super User III
Super User III

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

Thank you!

Worked perfectly

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (37,895)