# Dictionary Action Builder | Shortcuts Library

> JSON ⇐⇒ dictionary action conversion tool

## What this shortcut does

👉 Get Shortcut without Login
OS
Compatibility
≥ iOS 16.1
Yes
≥ macOS 13 Ventura
Yes
Older
Please use version 2.3.1 along with
Shortcut Source Helper
Please download the Actions app to use this shortcut.
Dictionary Action Builder
converts JSON text to native
Dictionary
or
List
actions and vice versa. Converted actions are put into the clipboard so that you can paste them in any shortcut. It can also convert between JSON and
Get Contents of URL
’s POST request body.
JSON → Dictionary/List/Get Contents of URL Action
This shortcut helps you create complex dictionary actions in Shortcuts. You can write and test dictionaries in JSON-style text, e.g.
{"name":"bong","happy":true}
, and later use this tool to convert them to native actions, avoiding painful steps in building multi-level actions manually.
Arrays, e.g.
["hello", "world"]
, can also be converted to list actions. It can convert multiple objects, e.g.
{} [2, 3] {"say":"hi"}
, at once and accepts (text, json, pdf, etc) files or text selection through a share sheet or file picker, or copied text in the clipboard. It can also convert a list of text items separated by new lines into a list action.
“Dictionaries in text form are easier to read and edit. Why convert to native actions?”
you may ask.
Native actions look cool :) but are hard to navigate and edit. Sometimes you would like to have native actions instead of messy text actions when you share your works with others. With this tool, you can continue using text dictionaries throughout your developing and testing phases.
Dictionaries in text form do not retain the order of the key/value pairs when run. This is a pain for JSON text when the order is important, for example, when using
Choose from List
. This tool preserves the order.
This tool converts numbers such as
3.14
,
3,14
or
٣٫١٤
into scientific notation
314E-2
that works for all regions.
You can create dictionaries containing newline characters in keys or values.
This tool is probably the only way to create lists with multiple-type items such as numbers, booleans and even dictionaries, e.g.
["text", -2.3, false, {"a":"b"}]
. Please be aware that a list inside a list will crash your shortcut.
Million thanks to
@dotdev
on
r/Shortcuts Discord
and

for the groundbreaking discovery of the UTI method!
Auto Mode
You can pass JSON text from another shortcut to copy converted Dictionary/List/Get Contents of URL actions into your clipboard without any user interaction.
Dictionary/Get Contents of URL Action → JSON
Select
Get JSON from Copied Action
from the menu and it will extract all Dictionary and Get Contents of URL actions and multi-type List actions containing dictionaries from the clipboard, convert them to JSON and let you quick look, share, save or copy to clipboard.
The main benefit of this tool over dumping JSON directly from actions is that this one preserves the key/value order, allowing you to edit and convert repeatedly.
Merging Dictionary Actions
Use
Shortcut Source Tool
to copy consecutive Dictionary actions then select
Merge Copied Dictionary Actions
from the menu, and it will merge them into one and copy to the clipboard. Same applies to consecutive multi-type List actions containing dictionaries. Simply put, the process is analogous to joining JSON objects:
{"a":1
}, {
"b":2}
→
{"a":1, "b":2}
[{"a":1
}], [{
"b":2}]
→
[{"a":1, "b":2}]

## Compatibility

iPhone, iPad, Mac

## Required apps

Actions

[View this page](https://shortcutlibrary.app/shortcuts/dictionary-action-builder)

[Download Shortcuts Library on the App Store](https://apps.apple.com/app/id6759494377)
