You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Java Lambda that I wish to sometimes populate a key with a string value, and sometimes set it to null, to indicate that the key is not meaningful in this case.
However if I set a key to have the value null, that key is not included in the output. Repro code:
public class App implements RequestHandler<Map<String, Object>, Map<String, Object>> {
@Override
public Map<String, Object> handleRequest(Map<String, Object> input, Context context) {
HashMap<String, Object> output = new HashMap<>();
output.put("nonNulllKey", "nonNull");
output.put("nullKey", null);
return output;
}
}
If you create a Lambda with this code, the result will include nonNulllKey, but not nullKey.
I've checked this is not a Lambda limitation by returning a None value in Python and confirming I can see the key with the null value in the response.
The text was updated successfully, but these errors were encountered:
The Java serialisation code and configuration can be found here JacksonFactory.java. It is configured to ignore nulls.
Changing this behaviour would likely effect another user.
With the next major version of the events library customers will have the ability to bring their own serialiser. This would give you the ability to configure the behaviour to match that of the Python runtime.
I have a Java Lambda that I wish to sometimes populate a key with a string value, and sometimes set it to null, to indicate that the key is not meaningful in this case.
However if I set a key to have the value null, that key is not included in the output. Repro code:
If you create a Lambda with this code, the result will include nonNulllKey, but not nullKey.
I've checked this is not a Lambda limitation by returning a
None
value in Python and confirming I can see the key with the null value in the response.The text was updated successfully, but these errors were encountered: