Hello everyone!
This is my first post in this forum. Looking forward to joining this friendly and helpful community! Please feel free to provide any feedback about how to create more meaningful posts.
Short-term objective: I want to access a nested JSON object (more complex than the one in this example ... but let's start simple for now) using a variable which is used as pointer to a specific (but changing) entry in the JSON dictionary.
Long-term objective (not part of the example macro shown here -> not directly relevant to answer this post but might be useful information to propose alternative approaches): I want to be able to quickly save emails from Apple Mail as pdf documents to specific folders. The folders shall be selected automatically based on the email address of the sender (e.g., if the email is from my bank, the Save As dialogue should automatically switch to the corresponding folder containing my bank documents). To have the "Save as" dialogue automatically switch to the relevant folder, I want to use a JSON containing multiple entries (also used for other purposes) containing the mail-address and the corresponding folder path for all frequently received emails.
I am relatively new to JSON. I read the manual page (especially the part about the JSON Paths) but it seems my JSON knowledge does not yet allow me to transfer the info from the manual to my specific use case.
The following macro contains two groups. The first group contains the direct approach to access the JSON content. The second group contains the attempt to access the JSON dictionary indirectly via the content of the pointer variable.
As other users might experience the same problem, I kept a history of all failed attempts in the macro. Actions colored in red do not yield the expected result.
Any help is greatly appreciated.
Here is the example macro:
Accessing JSON dictionary content with variable.kmmacros (5.5 KB)