1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

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 #1541.
This commit is contained in:
Eric Bréchemier
2017-11-29 18:26:56 +01:00
committed by Nico Williams
parent 239278fd3a
commit 476b36770d
2 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ David R. MacIver <david@drmaciver.com> - bug fixes
David Tolnay <dtolnay@gmail.com> - destructuring, build improvements
Doug Luce <doug@github.con.com> - build
Eiichi Sato <sato.eiichi@gmail.com>
Eric Bréchemier <eric@egull.co> - bug fix
Filippo Giunchedi <fgiunchedi@gmail.com> - bug fixes
Filippo Valsorda <filippo.valsorda@gmail.com> - recursive object merge (`*`)
Hanfei Shen <qqshfox@gmail.com>

View File

@ -237,7 +237,7 @@ def tostream:
else
# We really need a _streaming_ form of `keys`.
# We can use `range` for arrays, but not for objects.
keys as $keys |
keys_unsorted as $keys |
$keys[-1] as $last|
((# for each key
$keys[] | . as $key |