Suppose I have this dataset:
{"id": 99, "labeled_values": [["one", "green"], ["two", "red"], ["three", "blue"]], "flavors": ["hot", "cold"]}{"id": 100, "labeled_values": [["four", "green"], ["five", "red"]], "flavors": ["hot"]}
and I would like this output (tab-separated):
99 one green hot99 two red hot99 one green cold99 two red cold100 four green hot100 five red hot
This code (from here) works without the flavors:
$ cat tmp/foo.ndjson | jq -r '[.id] + .labeled_values[] | @tsv'99 one green99 two red99 three blue100 four green100 five red
Here is a failed attempt to add the flavor. It concatenates all the flavors, not one at a time.
$ cat tmp/foo.ndjson | jq -r '[.id] + .labeled_values[] + .flavors | @tsv'99 one green hot cold99 two red hot cold99 three blue hot cold100 four green hot100 five red hot