Name the key a document is written under
Choose the key --key wraps a document under, for a format whose root must be an object.
TOML and INI documents are tables of keys, so their root must be an object. When the document you translate into one has another value at its root, such as an array, dmog writes it under a key. --key names that key.
Choose the key #
Without --key, the key is items:
$ dmog translate --from yaml --to toml --path '["paths"]' server.yaml
"items" = [ "/api", "/health" ]
Give the key you want:
$ dmog translate --from yaml --to toml --path '["paths"]' --key paths server.yaml
"paths" = [ "/api", "/health" ]
What to watch for #
--key changes nothing when the root is already an object, or when the target takes any root. JSON, YAML, and XML take any value at their root, so they never wrap one.
Which formats need an object at the root is the Root column of the formats reference.