Skip to content

Instantly share code, notes, and snippets.

@mbajur
Created February 12, 2014 14:46
Show Gist options
  • Save mbajur/8956798 to your computer and use it in GitHub Desktop.
Save mbajur/8956798 to your computer and use it in GitHub Desktop.

Raw JSON

{\n  \"accountURL\": \"https://domain.com\",\n  \"newCommitsCount\": \"1\",\n  \"pushURL\":\"https://domain.com/project/64249/git/source/compare/revisions/0b6438955f2a5a7981fd25cfa5b48fe3fb4c888d,7771e638d1356a14d1dc46f3f5cfaab858370a5e\",\n  \"unsubscribeURL\": \"https://domain.com:443/unsubscribe?token=receiverToken&type=COMMITS&projectId=64249\",\n  \"invokerEmail\": \"email@email.com\",\n  \"projectURL\": \"https://domain.com/project/64249\",\n  \"projectId\": \"64249\",\n  \"afterPushRevision\": \"7771e638d1356a14d1dc46f3f5cfaab858370a5e\",\n  \"invokerId\": \"38074\",\n  \"pushDate\": \"2014-02-11T15:26:36+0000\",\n  \"beforePushRevision\": \"0b6438955f2a5a7981fd25cfa5b48fe3fb4c888d\",\n  \"repositoryURL\": \"git_url\",\n  \"subdomain\": \"subdomain\",\n  \"domain\": \"domain\",\n  \"branch\": \"develop\",\n  \"invokerProfileURL\": \"url\",\n  \"commitsCount\": \"1\",\n  \"invokerSmallAvatarURL\": \"xx\",\n  \"projectName\": \"NAME\",\n  \"invoker\": \"Invoker Name.\",\n  \"commits\": {\"commit\":   {\n    \"revision\": \"7771e638d1356a14d1dc46f3f5cfaab858370a5e\",\n    \"commitMessage\": \"quickfix\",\n    \"committerId\": \"38074\",\n    \"committerEmail\": \"email\",\n    \"committerName\": \"Name.\",\n    \"commitDate\": \"2014-02-11T15:26:27+0000\",\n    \"commitURL\": \"https://domain.com/project/64249/git/source/commit/develop/7771e638d1356a14d1dc46f3f5cfaab858370a5e\"\n  }}

What i'm doing with it?

# Remove line breaks, tripple back-slashes and change \" to "
# Btw: last method breaks my editor formatting
payload = unescape payload.replace(/\\n/g, '').replace(/\\\\\\/g, '"').replace(/\\"/g, '"')

# Parse it to JSON
payload = JSON.parse payload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment