Skip to content

Commit 8cd76b6

Browse files
committed
Extract address fields from JSON and format as comma-separated string using jq
1 parent ded628b commit 8cd76b6

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

jq/script-02.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ set -euo pipefail
55
# The input for this script is the person.json file.
66
# TODO: Write a command to output the address of the person, all on one line, with a comma between each line.
77
# Your output should be exactly the string "35 Fashion Street, London, E1 6PX", but should not contain any quote characters.
8+
jq -r '.address | to_entries | map(.value) | join(", ")' person.json

0 commit comments

Comments
 (0)