public void generateErrorMessage(String key) {
        StringBuilder sb = new StringBuilder();
        errorMessages.forEach(each -> sb.append(each).append(ToolConstants.COMMA));
        JsonObject outputJson = new JsonObject();
        outputJson.addProperty(key, HyscaleStringUtil.removeSuffixStr(sb,ToolConstants.COMMA));
        System.out.println(GsonProviderUtil.getPrettyGsonBuilder().toJson(outputJson));
    }
Class to handle output acivity in structured format like JSON/YAML.
commons/src/main/java/io/hyscale/commons/io/StructuredOutputHandler.java