Skip to content

Output a "flat" YAML #698

@debuglevel

Description

@debuglevel

Please describe your feature request.
Create an output with the full path of each key instead of the usual hierarchical YAML syntax. I don't know whether this would actually be a valid YAML, but it would be nice to be used for further processing.

Describe the solution you'd like
Example given:

animals:
  dogs: 3
  cats: 5

would convert it to

animals.dogs: 3
animals.cats: 3

This would be useful for further processing, e.g. creating environment variables like often used with for Docker:

cat settings.yml | yq eval flatten-my-stuff | ./some-bash-script.sh

ANIMALS_DOG=3
ANIMALS_CATS=5

Describe alternatives you've considered
Probably could also be done with some Python.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions