This is used to construct objects (or maps). This can be used against existing yaml, or to create fresh yaml documents.
Running
yq eval --null-input '{}'
will output
{}
Given a sample.yml file of:
name: Mike
then
yq eval '{"wrap": .}' sample.yml
will output
wrap:name: Mike
Given a sample.yml file of:
name: Mikepets:- cat- dog
then
yq eval '{.name: .pets.[]}' sample.yml
will output
Mike: catMike: dog
Given a sample.yml file of:
name: Mikepets:- cat- dog---name: Roseypets:- monkey- sheep
then
yq eval '{.name: .pets.[]}' sample.yml
will output
Mike: catMike: dogRosey: monkeyRosey: sheep
Running
yq eval --null-input '{"wrap": "frog"}'
will output
wrap: frog