Skip to content

Map/sequence keys seem to always produce empty-string as json #2289

Open
@thatch

Description

@thatch

Describe the bug

For whatever reason, yaml allows maps and sequences to be map keys. These seem to be interpreted as empty string when producing json.

Version of yq: v4.45.1
Operating system: mac
Installed via: homebrew

Input Yaml
data1.yml:

{}:
{x}:
[x]:

Command
The command you ran:

cat data1.yml | yq -o json .

Actual behavior

{
  "": null,
  "": null,
  "": null
}

Expected behavior

{
  "{}": null,
  "{x}": null,
  "[x]": null
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions