Skip to content

Handling null in Serializer #98

Closed
Closed

Description

@stasivanov

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.

Activity

  1. dimazen commented on Jun 22, 2017

    @dimazen
    Contributor

    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 :)

  2. stasivanov commented on Jun 22, 2017

    @stasivanov
    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!

  3. dimazen commented on Jun 24, 2017

    @dimazen
    Contributor

    Update will be rolled out tomorrow :)

  4. dimazen commented on Jun 25, 2017

    @dimazen
    Contributor

    @stasivanov you can check out 1.2.2 tag!

    Available via Carthage as well as via CocoaPods!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions