json.put("id", id == null ? null : id.longValue());
(json and id are both objects of our own types)
error over .put:
The method put(String, T) in the type Json is not applicable for the arguments (String, Long)Java(67108979)
lines without a ternary conditional operator, such as below, do not give an error
json.put("id", id.longValue());