public static String stripProperties()

in src/main/java/com/amazon/inspector/jenkins/amazoninspectorbuildstep/sbomgen/SbomgenUtils.java [39:56]


    public static String stripProperties(String sbom) {
        JsonObject json = JsonParser.parseString(sbom).getAsJsonObject();

        if (json == null || json.getAsJsonObject() == null || json.getAsJsonObject().get("components") == null) {
            AmazonInspectorBuilder.logger.printf("Strip properties failed the null check. json: %s, jsonObject: %s, " +
                            "components: %s%n", json == null, json.getAsJsonObject() == null,
                    json.getAsJsonObject().get("components") == null);
            return sbom;
        }

        JsonArray components = json.getAsJsonObject().get("components").getAsJsonArray();

        for (JsonElement component : components) {
            component.getAsJsonObject().remove("properties");
        }

        return json.toString();
    }