AnsweredAssumed Answered

Using JSONGetElement function to parse a Goggle API JSON reponse

Question asked by sblatter on Jan 26, 2018
Latest reply on Jan 29, 2018 by fmpdude

I am using Google's API to retrieve the time it takes to travel via Public Transportation between 2 addresses.

Google provides a JSON formatted text response that looks as follows:

{

   "destination_addresses" : [ "1020 56th Street, Brooklyn, NY 11219, USA" ],

   "origin_addresses" : [ "2103 57th Street, Brooklyn, NY 11204, USA" ],

   "rows" : [

      {

         "elements" : [

            {

               "distance" : {

                  "text" : "1.8 mi",

                  "value" : 2894

               },

               "duration" : {

                  "text" : "36 mins",

                  "value" : 2189

               },

               "status" : "OK"

            }

         ]

      }

   ],

   "status" : "OK"

}

 

Can someone please provide the correct syntax of the "JSONGetElement" function that will return bold highlighted value above i.e. 2189, which is the duration time in seconds?

Outcomes