public static void writeRegionSetAsJson(JsonGenerator generator, Set<Region<?, ?>> regions)
      throws IOException {
    generator.writeStartArray();

    if (!CollectionUtils.isEmpty(regions)) {

      for (final Region<?, ?> region : regions) {
        writeRegionDetailsAsJson(generator, region);
      }
    }
    generator.writeEndArray();
  }
The JsonWriter class is an utility to write various java types as a JSON string.
<p>

@since GemFire 8.0
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/util/JsonWriter.java