Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Strategies for parsing JSON on the Mac without installing anything
# using OSAScript's JavaScript support
osascript -l JavaScript -e "console.log(($(cat /Users/$(whoami)/Library/Application\ Support/Google/Chrome/Local\ State)).profile.info_cache.Default.user_name)"
# using python
cat /Users/$(whoami)/Library/Application\ Support/Google/Chrome/Local\ State | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["profile"]["info_cache"]["Default"]["user_name"];'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment