Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging two field into one #91

Open
ordinaryman09 opened this issue Jun 18, 2016 · 4 comments
Open

merging two field into one #91

ordinaryman09 opened this issue Jun 18, 2016 · 4 comments

Comments

@ordinaryman09
Copy link

hello,

is there any way to merge two field into one?
for example, if the dictionary contains the following:
{ street 1 : "xxx",
street 2 : "yyy" }

I want merge it to just "street" property.

thanks!

@viktorasl
Copy link
Contributor

Hey. You can use static jsonPreprocessing: method and merge those fields before persisting the object

@ordinaryman09
Copy link
Author

ordinaryman09 commented Jun 21, 2016

Thank you.
I check your code a little bit more and I noticed the selector you're looking for is preprocessedJSON not jsonPreprocessing. Also, I think it might be helpful for others if you update the ReadMe

+ (NSDictionary *)preprocessedJSON:(NSDictionary *)dictionary {
    NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:dictionary];
    dict[@"releaseCount"] = @(0);
    return dict.copy;
}

@viktorasl
Copy link
Contributor

Yes, sorry, the method is called preprocessedJSON:. PR is already made #93

@ordinaryman09
Copy link
Author

No worries. great work! Thanks brother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants