public static Collection<Map<String, Map<String, ?>>> convertConfigToMap(Configuration configuration) {
    Collection<Map<String, Map<String, ?>>> configurations = new ArrayList<>();
    Set<String> allConfigTypes = Sets.union(configuration.getProperties().keySet(), configuration.getAttributes().keySet());
    for (String configType: allConfigTypes) {
      Map<String, Map<String, ?>> configData = new HashMap<>();
      if (configuration.getProperties().containsKey(configType)) {
        configData.put(PROPERTIES_PROPERTY_ID, configuration.getProperties().get(configType));
      }
      if (configuration.getAttributes().containsKey(configType)) {
        configData.put(PROPERTIES_ATTRIBUTES_PROPERTY_ID, configuration.getAttributes().get(configType));
      }
      configurations.add(ImmutableMap.of(configType, configData));
    }
    return configurations;
  }
Converts {@link Configuration} objects to a collection easily serializable to Json
@param configuration the configuration to convert
@return the resulting collection
ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurableHelper.java