Skip to content

How to convert array of objects to csv? #1285

Answered by mikefarah
balki asked this question in Q&A
Discussion options

You must be logged in to vote

Good question - I should update the guide with this example.

yq '[["name", "species", "color"]] + [.items[] | [.name, .species, .color]]' examples/data1.yaml -o=csv
name,species,color
Tom,cat,blue
Jim,dog,brown

Replies: 1 comment 2 replies

Comment options

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

@mikefarah
Comment options

Answer selected by balki
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