Skip to content

Instantly share code, notes, and snippets.

@Asvarox
Created November 26, 2021 21:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Asvarox/7b412f7b7086947f883baf4c94cf4170 to your computer and use it in GitHub Desktop.
Save Asvarox/7b412f7b7086947f883baf4c94cf4170 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment