An engineer needs to convert an existing YAML-formatted inventory file into JSON format using a Python script. Which workflow accomplishes this transformation?
Loading YAML with `yaml.safe_load()` parses the inventory into native Python dictionaries and lists, then `json.dumps()` serialises that structure into a JSON string. This two-step parse-then-serialise workflow satisfies the stem's requirement to convert an existing YAML inventory into JSON, avoiding unsafe object construction.
Why this answer
To convert YAML to JSON, the engineer must read and parse the YAML file into a Python data structure using yaml.safe_load(), and then serialize that structure into a JSON string using json.dumps().