how to copy json to clipboard from the terminal
what i learned
Piping output to
pbcopy to copy and paste output from the terminal
Here's how I can grab the last 10 elements of a JSON array and copy them to my clipboard.
jq '.[-10:]' mydata.json | pbcopy
how i learned
I've been working with my spotify streaming history data and it's a lot of nested data so I've been using
jq a lot.
I'm working on restructuring a complicated nested JSON so I went to
pbcopy so I figured I'd try it and document it.
The final code looked more like
jq '.[-5:]' interim/streaming_history.json | pbcopy
jqplay sandbox environment online:
- what i ended up using jqplay for: https://jqplay.org/s/AMl-8okc7or