mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
13 lines
351 B
Plaintext
13 lines
351 B
Plaintext
def walk(f):
|
|
. as $in
|
|
| if type == "object" then
|
|
reduce keys_unsorted[] as $key
|
|
( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f
|
|
elif type == "array" then map( walk(f) ) | f
|
|
else f
|
|
end;
|
|
|
|
def keys_sort_by(f):
|
|
to_entries | sort_by(.key|f ) | from_entries;
|
|
|
|
walk(if type == "object" then keys_sort_by(ascii_upcase) else . end) |