-
-
Notifications
You must be signed in to change notification settings - Fork 717
Closed
Description
Describe the bug
#1924 was an issue where empty TOML tables haven't been converted to empty JSON objects. It has been supposedly fixed and closed, but it turns out that the fix isn't complete. It seems that empty tables are omitted from the output unless an empty table is the last table in the input. That's why it works for input containing only the empty table which is the only case for which a test has been added in the fix pull request.
Version of yq: 4.47.1
Operating system: Linux
Installed via: binary release
Input TOML
input.toml:
[firstEmptyTable]
[firstTableWithContent]
key = "value"
[secondEmptyTable]
[thirdEmptyTable]
[secondTableWithContent]
key = "value"
[fourthEmptyTable]
[fifthEmptyTable]Command
yq --input-format toml --output-format json input.toml
Actual behavior
{
"firstTableWithContent": {
"key": "value"
},
"secondTableWithContent": {
"key": "value"
},
"fifthEmptyTable": {}
}Expected behavior
{
"firstEmptyTable": {},
"firstTableWithContent": {
"key": "value"
},
"secondEmptyTable": {},
"thirdEmptyTable": {},
"secondTableWithContent": {
"key": "value"
},
"fourthEmptyTable": {},
"fifthEmptyTable": {}
}