Skip to content

Mapping each item of an array in a JSON response to a new line containing other fields from that structure #287

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

You must be logged in to vote

OK so I've got a version of this working:

$ dasel -w csv -f /Users/tom/tmp/dasel/287/data.json '.data.search.nodes.all().comments.nodes.all().mapOf(number,parent(3).number,title,parent(3).title,author,parent(3).author.login,createdAt,parent(3).createdAt,commentAuthor,author.login,commentText,bodyText,commentTime,createdAt).merge()'
author,commentAuthor,commentText,commentTime,createdAt,number,title
sgtpepper,jamesdean,I love this PR,2022-12-21T02:36:40Z,2022-12-21T02:35:59Z,6666.000000,Some PR title
sgtpepper,billybob,This PR is the best thing since sliced bread,2022-12-22T00:04:39Z,2022-12-21T02:35:59Z,6666.000000,Some PR title

Note that you'll need to use the latest version v2.1.0 for …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@eroth
Comment options

@TomWright
Comment options

@eroth
Comment options

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