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

XML output broken, CSV output column swapped #417

Open
rickhg12hs opened this issue Jul 2, 2024 · 2 comments
Open

XML output broken, CSV output column swapped #417

rickhg12hs opened this issue Jul 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rickhg12hs
Copy link

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
@rickhg12hs rickhg12hs added the bug Something isn't working label Jul 2, 2024
@TomWright
Copy link
Owner

Thanks for raising these issues. I'll address them ASAP

@pokle
Copy link

pokle commented Aug 22, 2024

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants