I'm using a tool that help me with translations but the tool's output not desirable, json keys are not sorted like input file.
jq -f reorder-by-reference.jq ./src/locales/en.json ./src/locales/tr.json > reordered_output.json
I'm using a tool that help me with translations but the tool's output not desirable, json keys are not sorted like input file.
jq -f reorder-by-reference.jq ./src/locales/en.json ./src/locales/tr.json > reordered_output.json
def reorder($in; $ref): $ref | reduce to_entries[] as {$key, $value} ({}; | |
.[$key] = ($in[$key] | objects |= reorder(.; $value)) | |
); | |
reorder(input; .) |