Commit ed8a2b3
feat(json): vim.json.encode() sort_keys neovim#35574
Problem: There is no way to ensure a stable key order when encoding a JSON string,
which can be useful for comparisons and producing cleaner diffs.
Solution: Introduce a `sort_keys` option for `vim.json.encode()`,which
is disabled by default. When enabled, object keys are sorted in
alphabetical order.1 parent ffc75e0 commit ed8a2b3
File tree
5 files changed
+269
-49
lines changed- runtime
- doc
- lua/vim/_meta
- src/cjson
- test/functional/lua
5 files changed
+269
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3391 | 3391 | | |
3392 | 3392 | | |
3393 | 3393 | | |
| 3394 | + | |
| 3395 | + | |
3394 | 3396 | | |
3395 | 3397 | | |
3396 | 3398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
0 commit comments