Created
March 22, 2017 23:11
-
-
Save darknoon/19c4ff57bbdde82d1c1cb53c4e3f1837 to your computer and use it in GitHub Desktop.
JSON.stringify doesn't really work on NSDictionary plist types does it…
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
const colorList = { | |
Haus: '#F3F4F4', | |
Night: '#333', | |
Sur: '#96DBE4', | |
'Sur Dark': '#24828F', | |
Peach: '#EFADA0', | |
'Peach Dark': '#E37059', | |
Pear: '#93DAAB', | |
'Pear Dark': '#2E854B', | |
}; | |
const json = '{"Haus":"#F3F4F4","Night":"#333","Sur":"#96DBE4","Sur Dark":"#24828F","Peach":"#EFADA0","Peach Dark":"#E37059","Pear":"#93DAAB","Pear Dark":"#2E854B"}'; | |
const jsonData = NSString.stringWithString(json).dataUsingEncoding(NSUTF8StringEncoding); | |
const parsed = NSJSONSerialization.JSONObjectWithData_options_error(jsonData, 0, null); | |
log(colorList.Haus) | |
log(JSON.stringify(colorList)) | |
log(parsed) | |
log(JSON.stringify(parsed)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment