Convert json files to tsv text blob

jq -r 'keys | join("\t")' $(ls -f *.json | head -1) && jq -Sr 'to_entries | [ .[] | .value | tostring ] | join("\t")' *.json
Grabs the first JSON file in the directory, reads its keys, prints TSV, then prints all the json files' values as TSV. Nested objects appear as json. Unhappy times if your json has literal tabs in it.
Sample Output
_id	about	address	age	balance	company	email	eyeColor	favoriteFruit	friends	greeting	guid	index	isActive	latitude	longitude	name	phone	picture	range	registered	tags
57083c8b5ff65f57d375e255	0	73e73186-ba78-4e6d-9663-57eb5919bbc9	true	$2,005.56	30	blue	{"first":"Blackburn","last":"Miranda"}	PULZE	+1 (836) 438-3256	389 Rockwell Place, Southmont, California, 6347	Anim ullamco velit enim ullamco sunt sunt ipsum tempor pariatur officia aute. Pariatur incididunt Lorem excepteur deserunt deserunt officia minim sint nisi cillum et magna fugiat. Do laboris dolore ipsum pariatur velit. Exercitation excepteur exercitation cillum eiusmod labore magna. Voluptate nulla veniam tempor minim anim est consectetur incididunt cupidatat ex. Eiusmod ex velit cupidatat Lorem minim do mollit ullamco sunt culpa excepteur.	Thursday, November 6, 2014 10:03 AM	60.671996	-94.85247	[7,"in"]	[0,1,2,3,4,5,6,7,8,9]	[3,{"id":1,"name":"Dunn Daniel"}]	Hello, Blackburn! You have 9 unread messages.	banana
57083c8b2f9273e388599eb8	1	b46e8e63-26c4-4fd6-b4d4-bae8f57b4f4c	false	$3,922.02	28	green	{"first":"Stark","last":"King"}	PRISMATIC	+1 (966) 491-3883	622 Irving Avenue, Eastmont, Maine, 9966	Quis officia nisi et tempor anim sit velit. Eu aliqua eu ut eu amet enim aute cupidatat quis qui do aute. Sunt eiusmod veniam excepteur proident veniam pariatur exercitation. Dolore id nulla eu laborum laborum labore. Ad tempor Lorem in ipsum consequat eu ad nisi adipisicing irure. Amet non pariatur amet sint.	Saturday, July 25, 2015 6:51 AM	57.349475	85.773508	[7,"in"]	[0,1,2,3,4,5,6,7,8,9]	[3,{"id":1,"name":"Dunn Daniel"}]	Hello, Stark! You have 9 unread messages.	banana
57083c8b71acd0f59fedc36a	2	ae36f083-b123-402f-91d1-67cf2e450feb	true	$1,977.56	29	blue	{"first":"Stone","last":"Carroll"}	FROLIX	+1 (874) 452-3838	938 Dahill Road, Sexton, Connecticut, 9259	Eiusmod tempor esse aute sit dolor aute aute occaecat aliquip occaecat esse officia. Sint amet cupidatat in magna voluptate. Aliqua consectetur et exercitation ullamco minim ut nostrud. Elit laboris Lorem commodo Lorem elit velit cupidatat velit dolor eiusmod eu in eu minim.	Saturday, August 22, 2015 9:30 PM	-70.378489	97.38272	[7,"in"]	[0,1,2,3,4,5,6,7,8,9]	[3,{"id":1,"name":"Dunn Daniel"}]	Hello, Stone! You have 8 unread messages.	apple
57083c8b20ae0667d75e7ef0	3	6d32ca46-07ba-42b9-85dc-07c3fe7f6c10	false	$2,170.25	33	green	{"first":"Latonya","last":"Ware"}	ANARCO	+1 (845) 569-2733	465 Myrtle Avenue, Lynn, Oklahoma, 3826	Aliqua amet officia deserunt enim minim eu labore consectetur sunt mollit sint officia fugiat dolor. Aliquip eu adipisicing id laborum quis culpa. Ut velit do deserunt voluptate tempor in anim magna aliquip ipsum in dolor. Minim culpa ea ut cupidatat consequat. Minim commodo veniam ut pariatur fugiat. Culpa tempor labore excepteur commodo sit adipisicing mollit in dolor qui incididunt et sit consectetur.	Sunday, March 22, 2015 12:39 AM	-67.522617	-105.250561	[7,"in"]	[0,1,2,3,4,5,6,7,8,9]	[3,{"id":1,"name":"Dunn Daniel"}]	Hello, Latonya! You have 10 unread messages.	strawberry
57083c8c3324cf5366112c8e	4	28f78639-595c-4e3b-8261-b7e109f58638	false	$3,587.78	27	green	{"first":"Juana","last":"Crane"}	ROCKYARD	+1 (994) 457-3481	747 Ovington Avenue, Northridge, Oregon, 142	Aliqua quis nulla velit dolore consequat irure in laborum voluptate esse. Duis consectetur non aliqua eu labore. Exercitation officia adipisicing pariatur laboris commodo duis elit irure est ex est eiusmod. Qui aliquip qui eiusmod do aliqua fugiat minim aliquip elit.	Monday, November 16, 2015 6:21 PM	-67.487595	48.295541	[7,"in"]	[0,1,2,3,4,5,6,7,8,9]	[3,{"id":1,"name":"Dunn Daniel"}]	Hello, Juana! You have 5 unread messages.	banana

By: drjeats
2016-04-08 23:30:30

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: