GNU bug report logs -
#21616
[PATCH] Enable sorting of JSON object keys when encoding
Previous Next
Reported by: Simen Heggestøyl <simenheg <at> gmail.com>
Date: Sun, 4 Oct 2015 19:16:01 UTC
Severity: normal
Tags: patch
Done: Simen Heggestøyl <simenheg <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 21616 <at> debbugs.gnu.org (full text, mbox):
Hi Simen,
On 10/04/2015 10:15 PM, Simen Heggestøyl wrote:
> When working with JSON data, it is often convenient to be able to
> prettify the data, and having object keys sorted in a fixed order.
> This patch adds the variable `json-encoding-object-sort-key' which
I think it's a "predicate", not a "key". See the argument names in
`sort' and `cl-sort': the latter has a :key keyword argument, but it has
different purpose.
Call it json-[encode-]key-sort-predicate, maybe?
> This gets rid of a lot of redundant code from `json-encode-hash-table'
> and `json-encode-plist' by going via alists, and using the logic of
> `json-encode-alist' commonly for all the structures.
The unification part makes me concerned, again, from the performance
standpoint. Did you do any measuring here?
> I was in doubt whether to make `json-pretty-print-ordered' and
> `json-pretty-print-buffer-ordered' their own commands, or if it would
> be better to provide this functionality by having `json-pretty-print'
> and `json-pretty-print-buffer' accept prefix arguments. I decided on
> the former, because I think it makes the commands easier to discover.
Yes, making them separate seems to be more in line with other Emacs
commands.
This bug report was last modified 9 years and 189 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.