// There can be several endpoints for one service.
for ( ServiceRef srvRef : desc.getServiceRefs() ) {
JsonObject epStats = new JsonObject() ;
statsJSON(epStats, srvRef) ;
services.put(srvRef.name, epStats) ;
JsonArray endpoints = new JsonArray() ;
epStats.put("endpoints", endpoints) ;
for ( String ep : srvRef.endpoints) {
endpoints.add(ep) ;
}
}
stats.put("services", services) ;
}