public String toJson() { JsonObject details = new JsonObject(); details.addProperty(FIELD_LEVEL, level.toString()); JsonArray conditionResults = new JsonArray(); for (EvaluatedCondition condition : this.conditions) { conditionResults.add(toJson(condition)); } details.add("conditions", conditionResults); return details.toString(); }