Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The file formats can optionally be provided as the 3rd and 4th parameter for the

To convert from SPDX 2 to SPDX 3.0.1:

* use the file extension `.jsonld.json` or `.jsonld`;
* use the file extension `.spdx3.json` or `.jsonld.json` or `.jsonld`;
* or add the options for the from and to file types:

java -jar tools-java-2.0.5-jar-with-dependencies.jar Convert hello.spdx hello.spdx.json TAG JSONLD
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/spdx/tools/SpdxToolsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public enum SerFileType {
static Map<String, SerFileType> EXT_TO_FILETYPE;
static {
HashMap<String, SerFileType> temp = new HashMap<>();
temp.put("spdx3.json", SerFileType.JSONLD);
temp.put("jsonld.json", SerFileType.JSONLD);
temp.put("jsonld", SerFileType.JSONLD);
temp.put("json", SerFileType.JSON);
Expand Down Expand Up @@ -159,10 +160,14 @@ public static SerFileType fileToFileType(File file)
if (fileName.endsWith("rdf.ttl")) {
ext = "rdf.ttl";
}
}if ("json".equals(ext)) {
}
if ("json".equals(ext)) {
if (fileName.endsWith("jsonld.json")) {
ext = "jsonld.json";
}
if (fileName.endsWith("spdx3.json")) {
ext = "spdx3.json";
}
}
SerFileType retval = EXT_TO_FILETYPE.get(ext);
if (SerFileType.JSON.equals(retval)) {
Expand Down
Loading