Ensure nil is translated to null in json.