We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f821f5 commit a875cb0Copy full SHA for a875cb0
lib/json.bash
@@ -123,12 +123,14 @@ JSON._dump() {
123
done
124
prev=("${line[@]}")
125
done < <(sort -k1,1V -u; )
126
+ local indent=$(( ${#stack} - 1 ))
127
for (( i=0; i<${#stack}; i++ )); do
128
if [ "${stack:$i:1}" = "a" ]; then
- echo -n "${JSON_ARR_END//INDENT/$(JSON._indent $i)}"
129
+ echo -n "${JSON_ARR_END//INDENT/$(JSON._indent $indent)}"
130
else
- echo -n "${JSON_OBJ_END//INDENT/$(JSON._indent $i)}"
131
+ echo -n "${JSON_OBJ_END//INDENT/$(JSON._indent $indent)}"
132
fi
133
+ (( indent-- ))
134
135
echo
136
}
0 commit comments