I\'ve got a Web-based API to which I would like to send POST/GET requests via AppleScript. I\'d like to retrieve and parse the response such that I can feed it into another app.
I needed to parse JSON in AppleScript, and made a very simple scriptable background app to do this. It really just ties two frameworks (JSON, Appscript) together.
It's now available free on the Mac AppStore. You can check out more examples on our website.
Usage is very simple:
tell application "JSONHelper"
-- return JSON from an AppleScript list
set jsonString to make JSON from {"A", "B", "C"}
log jsonString
set asList to read JSON from jsonString
-- return JSON from an AppleScript record
set jsonString to make JSON from {a_string:"string", a_list:{"abc", 123, false, true}}
log jsonString
-- return an AppleScript record from JSON
set asRecord to read JSON from jsonString
log asRecord
end tell