Hey, this is a combination of the GSON parser as well as the json specification.
If you leave the `Strings` absent from the JSON payload, then they will resolve to `null` on the Client, however this will not work with `Integers`, with will default to 0. It looks like GSON treats all numbers as `int`s, which cannot be null.
As a workaround, if you need null values for numbers, you can either add a boolean flag to indicate if a value has been set `doorsSet: false`, or you can treat all numbers as Strings and then do a `Integer.valueOf(...)` to get the numerical value.
almost 5 years ago
Hello Edward, thank you for your explanation.
My solution is ugly : if(myBean.getField() == 0) myBean.setField(null);