Expand description

Parsers for deserializing SPDX from different data formats.

The SPDX spec supports some data formats that are not supported by Serde, so parsing from JSON (and YAML) is achieved with the data format specific crates:

use spdx_rs::models::SPDX;

let spdx_file = std::fs::read_to_string("tests/data/SPDXJSONExample-v2.2.spdx.json")?;
let spdx_document: SPDX = serde_json::from_str(&spdx_file).unwrap();

assert_eq!(
    spdx_document.document_creation_information.document_name,
    "SPDX-Tools-v2.0"
);

Functions

Parse a tag-value SPDX document to SPDX.