diff --git a/README.md b/README.md index 97761ab..93713aa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main/java/org/spdx/tools/SpdxToolsHelper.java b/src/main/java/org/spdx/tools/SpdxToolsHelper.java index dfa9402..59ab84e 100644 --- a/src/main/java/org/spdx/tools/SpdxToolsHelper.java +++ b/src/main/java/org/spdx/tools/SpdxToolsHelper.java @@ -70,6 +70,7 @@ public enum SerFileType { static Map EXT_TO_FILETYPE; static { HashMap 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); @@ -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)) {