Skip to content

Instantly share code, notes, and snippets.

@ridvanaltun
Created September 24, 2024 22:28
Show Gist options
  • Save ridvanaltun/e9bea65b92b692df43d615f6b1074611 to your computer and use it in GitHub Desktop.
Save ridvanaltun/e9bea65b92b692df43d615f6b1074611 to your computer and use it in GitHub Desktop.
reorder json file by reference of another json file
def reorder($in; $ref): $ref | reduce to_entries[] as {$key, $value} ({};
.[$key] = ($in[$key] | objects |= reorder(.; $value))
);
reorder(input; .)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment