How to Enter and Manage Dictionary on iOS Shortcuts

If you are a fan of Shortcuts on either macOS or iOS, no doubt you would have encountered a similar problem as I. In order to load some data on to a custom shortcut, only sensible way would to do so is via a dictionary-type variable. But Shortcuts doesn’t make it easy to enter the data, let alone manage the data once entered. It’s all done on GUI, which is not ideal when the data needs to be either copied into or typed in.

Fortunately, we can import JSON-formatted text as a dictionary on Shortcuts. There are also more options available when it comes to JSON editors and tools; that’s another advantage over working solely on Shortcuts’ GUI-style dictionary.

  1. Create a text where, much like Shortcuts’ Dictionary format, follow the JSON syntax. For example, this is how text-based (string) keys and values are entered:

{"key": "value"}

  1. On the shortcut in question, copy the JSON text over in a Text variable.
  2. Add a “Get Dictionary from Input” action, and use the text variable as input.

To illustrate the potential uses, I have a shortcut made to populate backup schedules of different devices. If I were to manage them directly on the Shortcuts app through dictionary variable, I have to add key-value pair per device with its schedule. But with the import method, not only I can work with keyboards to type it all out, I can potentially copy-paste a similar schedule into a JSON.

It’s also possible to save the the text file on Data Jar, an app I have covered on App-to post. Once stored in the Data Jar, you can save and synchronize the dictionary variable for the future use. It is possible to achieve the same without the app, but I highly recommend it for its accessibility. Data Jar’s dictionary UI is nearly identical to that of Shortcuts, so I highly recommend saving it as a text file as well.

Leave a comment