Created
September 5, 2018 20:10
-
-
Save kurtroberts/698c962e9dd48ec1eacadc74b8df9469 to your computer and use it in GitHub Desktop.
Strategies for parsing JSON on the Mac without installing anything
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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