void (final Map<String, ProjectSetProcessor> processors, final ProjectSetProcessor.Context context, final Iterator<? extends Map.Entry<String, JsonElement>> iterator) { if (!iterator.hasNext()) return; final Map.Entry<String, JsonElement> entry = iterator.next(); String key = entry.getKey(); ProjectSetProcessor processor = processors.get(key); if (processor == null) { LOG.error("Processor not found for " + key); return; } List<Pair<String, String>> list; if (entry.getValue().isJsonObject()) { JsonObject object = entry.getValue().getAsJsonObject(); if (object.entrySet().size() == 1 && object.entrySet().iterator().next().getValue().isJsonArray()) { final Map.Entry<String, JsonElement> next = object.entrySet().iterator().next(); list = ContainerUtil.map(next.getValue().getAsJsonArray(), o -> Pair.create(next.getKey(), getString(o))); } else { list = ContainerUtil.map(object.entrySet(), entry1 -> { JsonElement value = entry1.getValue(); return Pair.create(entry1.getKey(), getString(value)); }); } } else { list = Collections.singletonList(Pair.create(entry.getKey(), entry.getValue().getAsString())); } processor.processEntries(list, context, () -> runProcessor(processors, context, iterator)); }