Skip to content

Requests with null value fields #114

Description

@XtraSonic

JSONObject, which is used to create the payload of the request, does not put fields in the payload if they have the value (java) null. If we want to add a field with the value null, it has to have the value "JSONObject.NULL" (see the json object documentation)

There are two ways we can handle this:

  1. Create a NullFieldModel class which gets a name and always returns the value JSONObject.NULL. When the user wants to set a field with a null value, it will create a new instance of this class and set it in the entity model.

  2. Treat all null values as JSONObject.NULL. This might have a backwards compatibility impact since now some fields which were previously ignored, will be added to the request and will have the value null.

I personally think that the first option is better.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions