private ConfigOrError resolveServiceConfig(List<ServiceInstance> instances) {
        final String serviceConfig = getServiceConfig(instances);
        if (serviceConfig == null) {
            return null;
        }
        log.debug("Found service config for {}", getName());
        if (log.isTraceEnabled()) {
            // This is to avoid blowing log into several lines if newlines present in service config string.
            final String logStr = serviceConfig.replace("\r", "\\r").replace("\n", "\\n");
            log.trace("Service config for {}: {}", getName(), logStr);
        }
        try {
            @SuppressWarnings("unchecked")
            Map<String, ?> parsedServiceConfig = GSON.fromJson(serviceConfig, Map.class);
            return serviceConfigParser.parseServiceConfig(parsedServiceConfig);
        } catch (JsonSyntaxException e) {
            return ConfigOrError.fromError(
                    Status.UNKNOWN
                            .withDescription("Failed to parse grpc service config")
                            .withCause(e));
        }
    }
Extracts and parse gRPC service config from the given service instances.

@param instances The list of instances to extract the service config from.
@return Parsed gRPC service config or null.
grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/nameresolver/DiscoveryClientNameResolver.java