private void writeIssue(DbSession session, Issue issue, JsonWriter json) {
String actionPlanKey = issue.actionPlanKey();
ActionPlan actionPlan = actionPlanKey != null ? actionPlanService.findByKey(actionPlanKey, UserSession.get()) : null;
Duration debt = issue.debt();
Rule rule = ruleService.getNonNullByKey(issue.ruleKey());
Date updateDate = issue.updateDate();
Date closeDate = issue.closeDate();
json
.prop("key", issue.key())
.prop("rule", issue.ruleKey().toString())
.prop("ruleName", rule.name())
.prop("line", issue.line())
.prop("message", issue.message())
.prop("resolution", issue.resolution())
.prop("status", issue.status())
.prop("severity", issue.severity())