Created
May 6, 2011 20:39
-
-
Save jamster/959738 to your computer and use it in GitHub Desktop.
Cleaning JSON
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
| require 'rubygems' | |
| require 'yajl/json_gem' | |
| require 'pp' | |
| json_string = DATA.read | |
| pp JSON.parse(json_string) | |
| __END__ | |
| {"contact": { | |
| "kABPersonEmailProperty": [{"email": "[email protected]","label": "Blah","label_local": "Blah"}, | |
| {"email": "[email protected]","label": "_$!<Home>!$_","label_local": "home"} | |
| ], | |
| "kABPersonAddressProperty": [{"label": "_$!<Home>!$_","label_local": "home","address": {"Country": "United States","Street": "AD1-L1\nAD1-L2\nAD-ST\nAD-ST2","ZIP": "111111","City": "AD-CITY","CountryCode": "us","State": "AD-ST"}}, | |
| {"label": "_$!<Work>!$_","label_local": "work","address": {"Country": "United States","Street": "Wrok 1","CountryCode": "us","City": "wc","State": "ws"}} | |
| ], | |
| "kABPersonFirstNameProperty": "John", | |
| "kABPersonLastNameProperty": "User", | |
| "kABPersonMiddleNameProperty": null, | |
| "kABPersonPrefixProperty": null, | |
| "kABPersonSuffixProperty": null, | |
| "kABPersonNicknameProperty": null, | |
| "kABPersonFirstNamePhoneticProperty": null, | |
| "kABPersonLastNamePhoneticProperty": null, | |
| "kABPersonMiddleNamePhoneticProperty": null, | |
| "kABPersonOrganizationProperty": "Company", | |
| "kABPersonJobTitleProperty": null, | |
| "kABPersonBirthdayProperty": "TODO: kABDateTimePropertyType", | |
| "kABPersonNoteProperty": null, | |
| "kABPersonCreationDateProperty": "TODO: kABDateTimePropertyType", | |
| "kABPersonModificationDateProperty": "TODO: kABDateTimePropertyType" | |
| } | |
| } |
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
| require 'rubygems' | |
| require 'yajl/json_gem' | |
| require 'pp' | |
| json_string = DATA.read | |
| pp JSON.parse(json_string) | |
| __END__ | |
| {"contact": { | |
| "kABPersonEmailProperty": [{"email": "[email protected]","label": "Blah","label_local": "Blah"}, | |
| {"email": "[email protected]","label": "_$!<Home>!$_","label_local": "home"} | |
| ], | |
| "kABPersonAddressProperty": [{"label": "_$!<Home>!$_","label_local": "home","address": {"Country": "United States","Street": "AD1-L1\nAD1-L2\nAD-ST\nAD-ST2","ZIP": "111111","City": "AD-CITY","CountryCode": "us","State": "AD-ST"}}, | |
| {"label": "_$!<Work>!$_","label_local": "work","address": {"Country": "United States","Street": "Wrok 1","CountryCode": "us","City": "wc","State": "ws"}} | |
| ], | |
| "kABPersonFirstNameProperty": "John", | |
| "kABPersonLastNameProperty": "User", | |
| "kABPersonMiddleNameProperty": null, | |
| "kABPersonPrefixProperty": null, | |
| "kABPersonSuffixProperty": null, | |
| "kABPersonNicknameProperty": null, | |
| "kABPersonFirstNamePhoneticProperty": null, | |
| "kABPersonLastNamePhoneticProperty": null, | |
| "kABPersonMiddleNamePhoneticProperty": null, | |
| "kABPersonOrganizationProperty": "Company", | |
| "kABPersonJobTitleProperty": null, | |
| "kABPersonBirthdayProperty": "TODO: kABDateTimePropertyType", | |
| "kABPersonNoteProperty": null, | |
| "kABPersonCreationDateProperty": "TODO: kABDateTimePropertyType", | |
| "kABPersonModificationDateProperty": "TODO: kABDateTimePropertyType" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment