Description
Currently, StandardBomParser only provides a save() method for writing the SBOM to a file. It would be helpful to also provide a to_json() method that returns the serialized SBOM content directly as JSON.
This would be especially useful in CLI and scripting contexts where the SBOM should be written to stdout or otherwise handled in-memory without creating a temporary file first.
Example
sbom_json = StandardBomParser.to_json(sbom, indent=4)
# or directly at the sbom object
sbom_json = sbom.to_json(indent=4)
print(sbom_json)
Description
Currently,
StandardBomParseronly provides asave()method for writing the SBOM to a file. It would be helpful to also provide ato_json()method that returns the serialized SBOM content directly as JSON.This would be especially useful in CLI and scripting contexts where the SBOM should be written to
stdoutor otherwise handled in-memory without creating a temporary file first.Example