Comments (1)
You are providing multiple JSON documents and converting them to CSV, resulting in multiple CSV documents. This is why the headers are repeated.
Option 1, merge all of the given documents documents into a single array of items:
$ echo '{
"name": "eagle",
"cores": 6,
"memory": 16384,
"virtio0": "standard:vm-111-disk-0,size=100G",
"virtio1": null,
"scsi0": null,
"scsi1": null
}
{
"name": "BI-Joe",
"cores": 2,
"memory": 12288,
"virtio0": "standard:vm-114-disk-0,discard=on,iothread=1,size=100G",
"virtio1": null,
"scsi0": null,
"scsi1": null
}' | dasel -r json -w csv 'all().merge()'
Option 2, just give dasel an array of objects in a single document:
$ echo '[
{
"name": "eagle",
"cores": 6,
"memory": 16384,
"virtio0": "standard:vm-111-disk-0,size=100G",
"virtio1": null,
"scsi0": null,
"scsi1": null
},
{
"name": "BI-Joe",
"cores": 2,
"memory": 12288,
"virtio0": "standard:vm-114-disk-0,discard=on,iothread=1,size=100G",
"virtio1": null,
"scsi0": null,
"scsi1": null
}
]' | dasel -r json -w csv
cores,memory,name,scsi0,scsi1,virtio0,virtio1
6,16384,eagle,null,null,"standard:vm-111-disk-0,size=100G",null
2,12288,BI-Joe,null,null,"standard:vm-114-disk-0,discard=on,iothread=1,size=100G",null
from dasel.
Related Issues (20)
- Delete selector can't find keys with null values HOT 2
- Special characters inside string literals are replaced with Unicode escape sequences in JSON HOT 3
- contains/includes HOT 2
- -w xml is not working when -r is not xml HOT 3
- Support multiple files HOT 1
- CSV file format: Support other characters as separator HOT 2
- Output formatting is not right in some arrays HOT 6
- [BUG] Dasel crash when reading an empty file HOT 5
- Is it possible to get a raw value, i.e. without quotes? HOT 3
- Preserve order of keys in JSON lists HOT 1
- How to iterate? HOT 2
- Something is wrong with the new update using the Windows binaries HOT 5
- Crash on Windows 7 x64 HOT 4
- Dasel query crashes with go panic HOT 8
- Supported toml version? HOT 1
- Null value causes incorrect error "property not found" HOT 1
- Empty string becoming null when modifying YAML HOT 4
- Windows installation instructions do not work HOT 1
- Compile builds with tinygo for reasonable system file sizes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dasel.