Skip to content

Instantly share code, notes, and snippets.

@adeekshith
Created May 2, 2015 06:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adeekshith/8c55b3b8f7b2891e300c to your computer and use it in GitHub Desktop.
Save adeekshith/8c55b3b8f7b2891e300c to your computer and use it in GitHub Desktop.
(* Gets JSON from a URL and extracts the data *)
(* Gets response in JSON format *)
apiResponse1 = Import["http://****shod.com/logdata/dessfaa/predictlocation", "JSON"];
(* Check returns 0 if an error occurs and Quiet supresses displaying errors *)
Quiet@Check[apiResponse1, 0]
(* Get response from JSON hierarchically *)
"latitude" /. ("prediction" /. apiResponse1)
(* latitude and prediction are the data keys in the JSON *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment