Skip to content

Instantly share code, notes, and snippets.

@nickjs
Created November 21, 2008 07:00
Show Gist options
  • Save nickjs/27380 to your computer and use it in GitHub Desktop.
Save nickjs/27380 to your computer and use it in GitHub Desktop.
- (id)jsonObject
{
var obj = {
"preferences": [[CPKeyedArchiver archivedDataWithRootObject:_preferences] string],
"profiles": _profiles,
"uploads": _uploads
};
return obj;
}
- (id)jsonTagObject
{
var obj = {
"name": [self name],
"birthdate": [_preferences objectForKey:kBirthdateKey],
"gender": [_preferences objectForKey:kGenderKey],
"view": [_preferences objectForKey:kViewKey],
"content": ""
};
return obj;
}
var data = [self jsonObject];
data["id"] = [self identifier];
if([self respondsToSelector:@selector(jsonTagObject)])
data["tags"] = [self jsonTagObject];
data = CPJSObjectCreateJSON(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment