Login About Gallery
Dictionary Action Builder
COMMENT
JSON ←→ dictionary action conversion tool 2021-09-08 v2.2.2 u/gluebyte https://routinehub.co/shortcut/4626
MATHS
Random number between
1
and
2
SCRIPTING
SCRIPTING
Get current IP address
Options Under Construction
SCRIPTING
If
Current IP Address
has any value
NETWORK
Get contents of
https://updatecheck.gluebyte.workers.dev/?id=5CC37B10
Options Under Construction
SCRIPTING
If
Contents of URL
does not contain
2021-09-08
SCRIPTING
Choose from Menu
🌏 Go to RoutineHub
SAFARI
Open
https://routinehub.co/shortcut/4626/
SCRIPTING
Exit shortcut with
Result
👾 Download Update
NETWORK
Get contents of
https://routinehub.co/api/v1/shortcuts/4626/versions/latest
Options Under Construction
WEB
Expand
https://routinehub.co/download/
Contents of URL
DOCUMENTS
Replace
^.+icloud.com/
with
shortcuts://
in
Expanded URL
Case Sensitive
Regular Expression
SAFARI
SCRIPTING
Exit shortcut with
Result
⮐ Not Now
End Menu
End If
End If
End If
SCRIPTING
Choose from Menu
📋 Read JSON from Clipboard
NUMBER
1
📝 Open JSON or Text File
NUMBER
2
⌨️ Enter JSON Text
NUMBER
3
🥢 Extract JSON from Shortcut
NUMBER
4
🖇 Merge Dictionary Actions
NUMBER
5
End Menu
SCRIPTING
SHARING
Get clipboard
End If
SCRIPTING
DOCUMENTS
Get File
Service
iCloud Drive
Show Document Picker
Select Multiple
SCRIPTING
Set name of
File
to
File
.txt
End If
SCRIPTING
SCRIPTING
Ask
Question
Input Type
Text
Default Answer
Text
End If
SCRIPTING
If
Menu Result
is greater than
3
SHORTCUTS
Run
Shortcut Source Helper
Input
Choose Variable
Show While Running
SCRIPTING
SCRIPTING
Get file of type
public.json
from
Shortcut Result
SCRIPTING
Choose from Menu
Standard (tabs)
TEXT
'\t'
Compact (3 spaces)
TEXT
3).replace(/( +|^)\{\n +/g,'$1{ '
End Menu
TEXT
const out = []; for (const a of actions) { if (a.WFWorkflowActionIdentifier === 'is.workflow.actions.dictionary' && (items = a.WFWorkflowActionParameters.WFItems)) { out.push(getdict(items.Value)); } else if (a.WFWorkflowActionIdentifier === 'is.workflow.actions.list' && (items = a.WFWorkflowActionParameters.WFItems) && JSON.stringify(a).includes('WFDictionaryFieldValueItems')) { out.push(items.map(getvalue)); } } document.write(out.length ? encodeURIComponent(out.map(d=>JSON.stringify(d,null,
Menu Result
)).join('\n\n')):'.'); function getdict(dict) { const out = {}; for (const d of dict.WFDictionaryFieldValueItems) { out[d.WFKey.Value.string] = getvalue(d); } return out; } function getvalue(d) { if (typeof d !== 'object') { return d; } let v = d.WFValue.Value; switch (d.WFItemType) { case 0: return getstr(v); case 1: return getdict(v.Value); case 2: return v.map(getvalue); case 3: return v.attachmentsByRange ? `NUMBER(${getstr(v)})` : Number(v.string); case 4: return v.Value ? `BOOLEAN(${varname(v.Value)})` : v; } } function getstr(v) { let str = v.string; Object.entries(v.attachmentsByRange ?? {}) .sort((a,b) => parseInt(a[0].match(/\d+/)[0])-parseInt(b[0].match(/\d+/)[0])) .forEach(a => { str = str.replace('\ufffc', `❰${varname(a[1])}❱`); }); return str; } function varname(v) { return v.OutputName ?? v.VariableName ?? v.Type ?? v; }
URL
data:text/html;charset=utf-8,<script>const actions =
File of Type
.WFWorkflowActions;
Text
</script>
SCRIPTING
Get file of type
com.apple.webarchive
from
URL
SCRIPTING
SCRIPTING
Show
No Dictionaries Found.
SCRIPTING
Exit shortcut with
Result
End If
SCRIPTING
URL
Decode
File of Type
SCRIPTING
SCRIPTING
If
WFInput?
is
<value>
DOCUMENTS
Show Open In Menu
Otherwise
SCRIPTING
If
Renamed Item
is less than
<value>
DOCUMENTS
Show
Renamed Item
in Quick Look
End If
SCRIPTING
Choose from Menu
💻 Share
SHARING
📝 Save
DOCUMENTS
Service
iCloud Drive
Ask Where to Save
📋 Copy to Clipboard
SHARING
Copy
Renamed Item
to clipboard
Local Only
Expire At
Today at 3 pm
End Menu
End If
SCRIPTING
Exit shortcut with
Result
End If
End If
SCRIPTING
DOCUMENTS
Replace
</array>\s*</dict>\s*<key>WFSerializationType</key>\s*<string>WFDictionaryFieldValue</string>\s*</dict>\s*(?:</dict>\s*</dict>\s*<dict>\s*<key>WFWorkflowActionIdentifier</key>\s*<string>is.workflow.actions.dictionary</string>\s*[\s\S]{120,300}|<key>WFSerializationType</key>\s*<string>WFDictionaryFieldValue</string>\s*</dict>\s*</dict>\s*</array>\s*</dict>\s*</dict>\s*<dict>\s*<key>WFWorkflowActionIdentifier</key>\s*<string>is.workflow.actions.list</string>[\s\S]{270,450})<key>WFDictionaryFieldValueItems</key>\s*<array>\s*
with
World
in
If Result
Case Sensitive
Regular Expression
Otherwise
SCRIPTING
Set
data
to
If Result
in
Dictionary
TEXT
let mode = 0; let stack = []; let output = '{"WFWorkflowActions":['; let action = ''; let actioncount = 0; while (buffer !== '') { if (mode == 0) { buffer = buffer.slice(buffer.search(/[\[\{]/)); let ch1 = buffer.charAt(0); switch (ch1) { case '{': mode = 1; action = '{"WFWorkflowActionIdentifier":"is.workflow.actions.dictionary","WFWorkflowActionParameters":{"WFItems":{"Value":{"WFDictionaryFieldValueItems":['; break; case '[': mode = 2; action = '{"WFWorkflowActionIdentifier":"is.workflow.actions.list","WFWorkflowActionParameters":{"WFItems":['; break; default: buffer = ''; } } let ch1 = buffer.charAt(0); buffer = buffer.slice(1); buffer = buffer.slice(buffer.search(/\S|$/)); if (ch1 === ']' || ch1 === '}') { if ((mode == 1 && ch1 === '}') || (mode == 2 && ch1 === ']')) { if (stack.length == 0) { output += action + ((mode == 1) ? ']},"WFSerializationType":"WFDictionaryFieldValue"}}},' : ']}},'); mode = 0; action = ''; actioncount++; } else { action += (mode == 1) ? ']},"WFSerializationType":"WFDictionaryFieldValue"},"WFSerializationType":"WFDictionaryFieldValue"}},' : '],"WFSerializationType":"WFArrayParameterState"}},'; mode = stack.pop(); } } else { buffer = ''; } } else { let ch2 = buffer[0]; let key = ''; if (!']},'.includes(ch2)) { let match; if (mode == 1) { match = buffer.match(/^"([^"\\]*(?:\\.[^"\\]*)*)"\s*:\s*/); buffer = buffer.slice(match[0].length); key = '"WFKey":{"Value":{"attachmentsByRange":{},"string":"' + match[1] + '"},"WFSerializationType":"WFTextTokenString"},'; ch2 = buffer[0]; } switch (ch2) { case '[': case '{': stack.push(mode); if (ch2 === '{') { mode = 1; action += '{"WFItemType":1,' + key + '"WFValue":{"Value":{"Value":{"WFDictionaryFieldValueItems":['; } else { mode = 2; action += '{"WFItemType":2,' + key + '"WFValue":{"Value":['; } break; case '"': match = buffer.match(/^"([^"\\]*(?:\\.[^"\\]*)*)"\s*/); buffer = buffer.slice(match[0].length); value = match[1]; action += (mode == 1) ? '{"WFItemType":0,' + key + '"WFValue":{"Value":{"attachmentsByRange":{},"string":"' + value + '"},"WFSerializationType":"WFTextTokenString"}},' : '"' + value + '",'; break; default: match = buffer.match(/^(.+?)\s*[,\]\}]/); buffer = buffer.slice(match[0].length-1); value = match[1]; if (value === 'true') { action += '{"WFItemType":4,' + key + '"WFValue":{"Value":true,"WFSerializationType":"WFNumberSubstitutableState"}},'; } else if (value === 'false') { action += '{"WFItemType":4,' + key + '"WFValue":{"Value":false,"WFSerializationType":"WFNumberSubstitutableState"}},'; } else if (value === 'null') { action += (mode == 1) ? '{"WFItemType":0,' + key + '"WFValue":{"Value":{"attachmentsByRange":{},"string":""},"WFSerializationType":"WFTextTokenString"}},' : ''; } else { let numStr = parseFloat(value).toString(); match = numStr.match(/(-?\d+)\.(\d+)/); value = match ? parseInt(match[1] + match[2]) + 'E-' + match[2].length : numStr; action += '{"WFItemType":3,' + key + '"WFValue":{"Value":{"attachmentsByRange":{},"string":"' + value + '"},"WFSerializationType":"WFTextTokenString"}},'; } } } } } output += '],"WFWorkflowIcon":{"WFWorkflowIconStartColor":4292093695}}' document.write(actioncount ? encodeURIComponent(output.replace(/\n/g, '\\n')) : '');
URL
data:text/html;charset=utf-8,<script>let buffer =
Dictionary
.data;
Text
</script>
SCRIPTING
Get file of type
com.apple.webarchive
from
URL
SCRIPTING
URL
Decode
File of Type
SCRIPTING
If
URL Encoded Text
begins with
{
SCRIPTING
Get file of type
com.apple.plist
from
URL Encoded Text
Otherwise
SCRIPTING
Show alert
Data Error
Title
Data Error
Show Cancel Button
SCRIPTING
Exit shortcut with
Result
End If
End If
SCRIPTING
Ask
New shortcut name:
Input Type
Text
SCRIPTING
Set name of
If Result
to
Provided Input
.plist
SHORTCUTS
Run
Shortcut Source Helper
Show While Running

Showcuts

Magic Vars

Screenshot

Submitted Anonymously a month ago

Visit iCloud (iOS)

Copy iCloud Link

Scan QR Code

0