Skip to content

CSV has multiple header lines when converting from ndjson #199

Answered by TomWright
kbrown asked this question in Q&A
Discussion options

You must be logged in to vote

Dasel treats a newline in JSON as a separate document, similar to the --- separate in YAML.

You need to use the --merge-input-documents flag.

Example:

$ echo '{
    "_id" : "6001c87baff07b000760f696",
    "title" : "Acme Demo Company Risk Review",
    "description" : "Acme Demo"
}
{
    "_id" : "6005a424aff07b0007619253",
    "title" : "Acme Industries",
    "description" : "Demo Quick"
}' | dasel -r json -w csv --merge-input-documents
_id,description,title
6001c87baff07b000760f696,Acme Demo,Acme Demo Company Risk Review
6005a424aff07b0007619253,Demo Quick,Acme Industries

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@kbrown
Comment options

@TomWright
Comment options

Comment options

You must be logged in to vote
1 reply
@kbrown
Comment options

Answer selected by TomWright
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants