To answer a specific question (after a quick re-reading), the only Applescript web support is through the URL Access Scripting library, which is just a shell for the curl terminal command. It is a little buggy and does not report everything that is needed.
In addition, there is no native JSON support in Applescript, and it will be a bit painful. To parse JSON, you need to use Applescript text item delimiters .
set mJson to "\"result\":\"success\",\"image\":\"foo\", \"name\":\"bar\"" -- get your data into a string somehow, like a function set AppleScript text item delimiters to {","} set keyValueList to (every text item in mJson) as list set AppleScript text item delimiters to "" (*"result":"success", "image":"foo", "name":"bar"*) repeat with thiskeyValuePair from 1 to (count keyValueList) set theKeyValuePair to item thiskeyValuePair of keyValueList set AppleScript text item delimiters to {":"} set theKeyValueBufferList to (every text item in theKeyValuePair) as list set AppleScript text item delimiters to "" set theKey to item 1 of theKeyValueBufferList (*"result"*) set theValue to item 2 of theKeyValueBufferList (*"success"*) end repeat
All this is done when everything goes right. You will need to take into account ill-formed JSON, as in your example, which contains an extra comma where it does not belong, and deviations, such as extra spaces and the like. If you can manipulate the data elsewhere to get what you need, I would suggest doing it. Applescript is not very good for such things.
Philip regan
source share