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

Handling null in Serializer #98

Closed
stasivanov opened this issue Jun 21, 2017 · 4 comments
Closed

Handling null in Serializer #98

stasivanov opened this issue Jun 21, 2017 · 4 comments

Comments

@stasivanov
Copy link

stasivanov commented Jun 21, 2017

Serializer.m has if (returnedValue) at 49th line.

The problem is that because of this all null values are not included in the output Dictionary, and that's why it cannot be used to fill another object correctly with Deserializer.

Also, sometimes I really need to serialize json to contain all keys even if they are null or empty.

I hope this is very clear, but anyway - for example, I have class User with email. user1 has email "test@mail.com". Now I create another user2 as a full copy of user1. Then I reset user2's email to nil, and want to apply those changes to user1 by filling it with the representation got by serializing user2. And you know, this won't work as expected.

In case this line was added because of some specific reasons, then, please add a possibility to ignore it by force, so it will be possible to get the full representation, and not only for filled properties.

@dimazen
Copy link
Contributor

dimazen commented Jun 22, 2017

Hello, @stasivanov! Thanks for your report!
I got your issue: null values don't get added into the resulting JSON. Let me take a closer look on it on today's evening. Also you can make a pull request :)

@stasivanov
Copy link
Author

@dimazen, I'm not sure I won't break anything else :)

In addition, it would be great to leave the current logic, but add the logic to include null values to the resulting JSON as an optional way. Cause, sometimes it is really great to have it with current logic, but sometimes no.

Thanks!

@dimazen
Copy link
Contributor

dimazen commented Jun 24, 2017

Update will be rolled out tomorrow :)

@dimazen
Copy link
Contributor

dimazen commented Jun 25, 2017

@stasivanov you can check out 1.2.2 tag!

Available via Carthage as well as via CocoaPods!

@dimazen dimazen closed this as completed Jun 25, 2017
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