1SPDX-License-Identifier: CC-BY-4.0 2 3## Usage 4 5A json.Unmarshal function on the v2_2.Document struct is defined so that when the JSON is unmarshalled, the function is called and the JSON can be processed in a custom way. Then a new map[string]interface{} is defined which temporarily holds the unmarshalled JSON. The map is then parsed into the v2_2.Document using functions defined for each different section. 6 7JSON => map[string]interface{} => v2_2.Document 8 9## Some Key Points 10 11- The packages have a property "hasFiles" defined in the schema which is an array of the SPDX Identifiers of the files of that package. The parser first parses all the files into the UnpackagedFiles map of the document and then when it parses the Packages, it removes the respective files from the UnpackagedFiles map and places them inside the Files map of the corresponding package. 12 13- The snippets have a property "snippetFromFile" which has the SPDX identifier of the file to which the snippet is related. Thus the snippets require the files to be parsed before them. Then the snippets are parsed one by one and inserted into the respective files using this property. 14 15## Assumptions 16 17The json file loader in `package jsonloader` makes the following assumptions: 18 19### Order of appearance of the properties 20* The parser does not make any assumptions based on the order in which the properties appear. 21 22### Annotations 23* The JSON SPDX schema does not define the SPDX Identifier property for the annotation object. The parser assumes the SPDX Identifier of the parent property of the currently-being-parsed annotation array to be the SPDX Identifer for all the annotation objects of that array. 24