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
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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,729)