private static void createFlatConfig(ConfigObject currentConfigObject, Map<String, Object> rootConfig, String prefix) { Set keySet = currentConfigObject.keySet(); for (Object key : keySet) { Object value = currentConfigObject.get(key); if(value instanceof ConfigObject) { ConfigObject sub = ((ConfigObject) value).clone(); String fullPath = prefix + key; if(!sub.isEmpty()) { Map flattened = sub.flatten(); sub.putAll(flattened); createFlatConfig(sub, rootConfig, fullPath + "."); if(!rootConfig.containsKey(fullPath)) { rootConfig.put(fullPath, sub); } } } else { rootConfig.put(prefix + key, value); } } }