dasel
dasel copied to clipboard
XML output broken, CSV output column swapped
Describe the bug
-w xml does not produce desired output.
-w csv reorders columns.
To Reproduce Steps to reproduce the behavior:
$ go version
go version go1.22.4 linux/amd64
$ ~/go/bin/dasel --version
dasel version development-v2.8.1
$ cat thrust.csv
Time,Thrust,Source
0,0,eng
0.000,0.51,eng
0.002,0.051,sim
0.004,0.152,sim
$ ~/go/bin/dasel -r csv -w csv -f thrust.csv
Source,Thrust,Time
eng,0,0
eng,0.51,0.000
sim,0.051,0.002
sim,0.152,0.004
$ ~/go/bin/dasel -r csv -w json -f thrust.csv
[
{
"Time": "0",
"Thrust": "0",
"Source": "eng"
},
{
"Time": "0.000",
"Thrust": "0.51",
"Source": "eng"
},
{
"Time": "0.002",
"Thrust": "0.051",
"Source": "sim"
},
{
"Time": "0.004",
"Thrust": "0.152",
"Source": "sim"
}
]
$ ~/go/bin/dasel -r csv -w xml -f thrust.csv
[0xc000303180 0xc0003031e0 0xc000303220 0xc000303280]
$ ~/go/bin/dasel -r csv -w xml -f thrust.csv
[0xc0003ba060 0xc0003ba0a0 0xc0003ba0e0 0xc0003ba140]
$ ~/go/bin/dasel -r csv -w xml -f thrust.csv
[0xc00029a2a0 0xc00029a2e0 0xc00029a320 0xc00029a3a0]
Expected behavior
-w xml should produce valid XML.
-w csv should not reorder CSV columns.
Desktop (please complete the following information):
- OS: Fedora release 40 (Forty)
- Version: dasel version development-v2.8.1
Thanks for raising these issues. I'll address them ASAP
I'm bumping into the same issue. I managed to reduce it to:
> echo -e '[{}]' | dasel -r json -w xml
[0x140002d1e80]
> echo -e 'a\na\n' | dasel -r csv -w xml
[0x1400022d1a0]