Skip to content

toml format conversion error #2618

@LovesAsuna

Description

@LovesAsuna

Describe the bug
toml format conversion error

Version of yq: v4.52.4
Operating system: any

Input Json
data1.json:

{
  "_source": {
    "cookie": [
      {
        "Domain": "",
        "Expires": "0001-01-01T00:00:00Z",
        "HttpOnly": false,
        "MaxAge": 0,
        "Name": "name",
        "Path": "",
        "Raw": "",
        "RawExpires": "",
        "SameSite": 0,
        "Secure": false,
        "Unparsed": null,
        "Value": "value"
      }
    ]
  },
  "highlight": {
    "did": [
      "did"
    ]
  },
  "sort": [
    1
  ]
}

Command
The command you ran:

yq -pj -otoml data1.json

Actual behaviour

[[_source.cookie]]
Domain = ""
Expires = "0001-01-01T00:00:00Z"
HttpOnly = false
MaxAge = 0
Name = "name"
Path = ""
Raw = ""
RawExpires = ""
SameSite = 0
Secure = false
Unparsed = ""
Value = "value"
highlight = { did = ["did"] }
sort = [1]

Expected behaviour

sort = [ 1 ]

[_source]
[[_source.cookie]]
Domain = ""
Expires = "0001-01-01T00:00:00Z"
HttpOnly = false
MaxAge = 0
Name = "name"
Path = ""
Raw = ""
RawExpires = ""
SameSite = 0
Secure = false
Value = "value"

[highlight]
did = [ "did" ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions