r/applescript • u/Culist • Jun 14 '21
Communicate to applescript with a json file?
I have another program written in js, and i want it to communicate to applescript, by writing into a json file, and applescript constantly pulls from the json file. Is it even possible, or viable? If not, are there any better alternatives?
4
Upvotes
2
u/CO_Automation Jun 14 '21
You can use applescriptObj-C to read and write json. The forums at late night software have some useful posts on the topic.
Once you the json schema it’s pretty simple.
2
u/CaptureJuan Jun 14 '21
There is an Applescript app called “Json helper” you can use to make it a bit simpler and avoid the extra layer of asObjC…
1
u/TrickyTramp Jun 14 '21
There is a JavaScript binding for AppleScript called JXA. Meaning you can do AppleScript, but just using JS instead. IMO it makes a little bit more sense, although the documentation is not great. You should be able to use it to natively parse JSON.
0
u/[deleted] Jun 14 '21
[deleted] — view deleted comment