Skip to content

useSortedKeys

~/.config/zed/settings.json
{
"code_actions_on_format": {
"source.action.useSortedKeys.biome": true,
}
}

Sorts the keys of a JSON object in natural order

{
"vase": "fancy",
"nested": {
"omega": "bar",
"alpha": "foo"
}
}
code-block.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Source action diff:

1 1 {
2 - ····vase:·fancy,
3 - ····nested:·{
2+ ····nested:·{
4 3 “omega”: “bar”,
5 4 “alpha”: “foo”
6 - ····}
5+ ····},
6+ ····vase:·fancy
7 7 }
8 8

code-block.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Source action diff:

2 2 “vase”: “fancy”,
3 3 “nested”: {
4 - ········omega:·bar,
5 - ········alpha:·foo
4+ ········alpha:·foo,
5+ ········omega:·bar
6 6 }
7 7 }

biome.json
{
"assist": {
"actions": {
"source": {
"useSortedKeys": "on"
}
}
}
}