Skip to content

Commit 476b367

Browse files
Eric Bréchemiernicowilliams
Eric Bréchemier
authored andcommitted
Keep object keys in parsing order in tostream output
As noted by @nicowilliams, `tostream` used `keys`, which sorts the keys in alphabetical order, instead of `keys_unsorted`, which preserves the parsing order. Fixes jqlang#1541.
1 parent 239278f commit 476b367

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ David R. MacIver <[email protected]> - bug fixes
2424
David Tolnay <[email protected]> - destructuring, build improvements
2525
Doug Luce <[email protected]> - build
2626
Eiichi Sato <[email protected]>
27+
Eric Bréchemier <[email protected]> - bug fix
2728
Filippo Giunchedi <[email protected]> - bug fixes
2829
Filippo Valsorda <[email protected]> - recursive object merge (`*`)
2930
Hanfei Shen <[email protected]>

src/builtin.jq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def tostream:
237237
else
238238
# We really need a _streaming_ form of `keys`.
239239
# We can use `range` for arrays, but not for objects.
240-
keys as $keys |
240+
keys_unsorted as $keys |
241241
$keys[-1] as $last|
242242
((# for each key
243243
$keys[] | . as $key |

0 commit comments

Comments
 (0)