Search code examples
arraysapplescriptrecords

Retrieving items from AppleScript record


I have an AppleScript record, myJSON, which I've created from a JSON entry using JSON Helper:

{"height":200.0,"width":300.0,"productoption":["fabric","rectangle","roll"],"id":33,"product":["backdrop"]}

I can easily access all the keys with a single entry by using, for example,

product of myJSON

I can't figure out how to access the productoption key which has a multiple entries.


Solution

  • Actually it's exactly the same way, the value for key productoption is an array (list in AppleScript terms)

    set options to productoption of myJSON
    repeat with anOption in options
        display dialog anOption
    end repeat