How do I parse JSON to use variable? toMap and getJSON are confusing...

How do I parse JSON to use variable? toMap and getJSON are confusing...

Hey Everyone!

I would love some help with this. I'm stuck. I have the following JSON.

  1. {  
  2.    "result":[  
  3.       {  
  4.          "bearing":-1,
  5.          "currentStateDuration":"00:53:14",
  6.          "exceptionEvents":[  

  7.          ],
  8.          "isDeviceCommunicating":true,
  9.          "isDriving":false,
  10.          "latitude":34.9946861,
  11.          "longitude":-106.659889,
  12.          "speed":0.0,
  13.          "dateTime":"2017-03-02T19:31:44.000Z",
  14.          "device":{  
  15.             "id":"b1"
  16.          },
  17.          "driver":"UnknownDriverId",
  18.          "groups":[  
  19.             {  
  20.                "children":[  

  21.                ],
  22.                "id":"GroupCompanyId"
  23.             }
  24.          ]
  25.       }
  26.    ]
  27. }

All I would like to do is map the variables. I have tried, toMap, getJSON, JSONtolist etc. Any help would be great! Here is my current code:

  1. string GeoTabApi.get.DeviceStatusInfo(string message)
  2. {
  3.     
  4. result = thisapp.GeoTabApi.call(input.message);
  5. resultJSON = result.getJSON("result");

  6.     resultMap = resultJSON.toMap();
  7.     lat = resultMap.get("latitude");
  8.     info result;
  9.     long = resultMap.get("longitude");
  10.     GMapsURL = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + long;
  11.     return GMapsURL;
  12. }
Any help would be FANTASTIC! Thanks!