How to convert JSON to AppleScript properties How can I get AppleScript to run this query and save each value (country, city, etc.) as an AppleScript variable?

http://ip-api.com/json/8.8.8.8?fields=country,city,isp,org,as,mobile,proxy,message


I'm trying to get information about IP and domain and set the value of some variables.

I was not sure how to even run the query from AppleScript so I used do shell script to call curl:

set IPAddress to "8.8.8.8"
set link to "http://ip-api.com/json/" &amp; IPAddress &amp; "?fields=country,city,isp,org,as,mobile,proxy,message"
set curl_command to "curl " &amp; link

do shell script curl_command


The result is JSON formatted text. Is AppleScript's text delimiter the only option for parsing the result?
The easiest way is to use JSON Helper app available on the AppStore. Then you simply do something like this:

tell application "JSON Helper"
    set json to fetch JSON from "http://ip-api.com/json/8.8.8.8?fields=country,city,isp,org,as,mobile,proxy,message"
    set countryName to |country| of json
end tell


Result: "United States"