Only encode the payload, if it is not equal to null