Skip to content

Commit 47c3715

Browse files
committed
Print properly compacted JSON
1 parent 42e21c5 commit 47c3715

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

csv-to-json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ print_row() {
1818
local IFS=','
1919
local -a row
2020
for ((i=0; i < ${#FIELDS[@]}; i++)); do
21-
row[i]=$(printf '"%s": "%s"' "${FIELDS[i]}" "${VALUES[i]}")
21+
row[i]=$(printf '"%s":"%s"' "${FIELDS[i]}" "${VALUES[i]}")
2222
done
2323

24-
printf '{'
25-
printf '%s' "${row[*]}"
26-
printf '}'
24+
printf '{%s}' "${row[*]}"
2725
}
2826

2927
if read_csv_fields; then

0 commit comments

Comments
 (0)