Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rejects empty TOML tables #1924

Closed
real-or-random opened this issue Jan 24, 2024 · 2 comments · Fixed by #1936
Closed

Rejects empty TOML tables #1924

real-or-random opened this issue Jan 24, 2024 · 2 comments · Fixed by #1936
Labels

Comments

@real-or-random
Copy link

real-or-random commented Jan 24, 2024

Describe the bug

yq rejects perfectly legal empty TOML tables
Version of yq: v4.40.5

Input Toml

input.toml:

[emptyTable]

Command

yq -o=json '.' input.toml

Actual behavior

Error: bad file 'input.toml': error retrieving table [emptyTable] value: %!w(<nil>)

Expected behavior

Parsing works. https://toml.io/en/v1.0.0#table says: "Empty tables are allowed and simply have no key/value pairs within them."

@mikefarah
Copy link
Owner

Looking at other TOML -> JSON tools, it looks like empty tables should map to an empty object. I've updated your fix @elibroftw with that in mind. Will be part of the next release.

@mikefarah mikefarah reopened this Feb 8, 2024
@mikefarah
Copy link
Owner

Fixed in 4.40.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants