Skip to content

Deserialising an empty character as json null instead of json undefined #26

@milanov

Description

@milanov

Recently we changed a type in one object from JsonNullable<String> sth = JsonNullable.undefined() to JsonNullable<Character> sth = JsonNullable.undefined(). Soon after we noticed a change in the deserialisation behaviour - explicit updates of that property to an empty string ("") no longer worked, as they were treated as not present (JsonNullable.undefined instead of JsonNullable[null]).

It seems that the issue is in the JsonNullableDeserializer, namely in the constructor:

this.isStringDeserializer = ((ReferenceType) fullType).getReferencedType().isTypeOrSubTypeOf(String.class);

Does it make sense to change the check and include Character as well as String? Or would you suggest another alternative? If it is the former, we can also open a PR, as the change doesn't seem so large (and there is already #4 for inspiration).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions