private String buildUpstreamJsonFromInstance(final Instance instance) {
        JsonObject upstreamJson = new JsonObject();
        upstreamJson.addProperty("url", instance.getIp() + ":" + instance.getPort());
        // status 0:true, 1:false
        upstreamJson.addProperty("status", instance.isHealthy() ? 0 : 1);
        upstreamJson.addProperty("weight", instance.getWeight());
        Map<String, String> metadata = instance.getMetadata();
        upstreamJson.addProperty("props", metadata.get("props"));
        boolean secure = false;
        if (metadata.containsKey("secure")) {
            secure = Boolean.parseBoolean(metadata.get("secure"));
        }
        String scheme = secure ? "https://" : "http://";
        upstreamJson.addProperty("protocol", Optional.ofNullable(metadata.get("protocol")).orElse(scheme));
        return GsonUtils.getInstance().toJson(upstreamJson);
    }
The type Nacos instance register repository.
shenyu-registry/shenyu-registry-nacos/src/main/java/org/apache/shenyu/registry/nacos/NacosInstanceRegisterRepository.java