@Override public JsonObject toJson() { JsonObject root = new JsonObject(); root.add("name", config.getName()); JsonArray publisherList = new JsonArray(); for (WanPublisherConfig publisherConfig : config.getWanPublisherConfigs()) { WanPublisherConfigDTO dto = new WanPublisherConfigDTO(publisherConfig); publisherList.add(dto.toJson()); } root.add("publishers", publisherList); return root; }