Created
April 30, 2014 23:18
-
-
Save alejandrobernardis/67003c983625edf2c681 to your computer and use it in GitHub Desktop.
Apple, InApp Purchase, Json Sanitize
This file contains hidden or 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
| # Thanks Martijn Pieters => http://stackoverflow.com/a/11242838/3161405 | |
| import re | |
| import json | |
| APPLE_SANITIZE = re.compile(r'("[^"]*")\s*=\s*("[^"]*");') | |
| APPLE_SANITIZE_COMMA = re.compile(r',(\s*})') | |
| def apple_json_sanitize(value): | |
| return json.loads( | |
| APPLE_SANITIZE_COMMA.sub( | |
| r'\1', APPLE_SANITIZE.sub( | |
| r'\1: \2,', value | |
| ) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment