unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* two json.el bugs
@ 2017-05-05 17:51 Theresa O'Connor
  2017-05-05 18:44 ` Yuri Khan
  2017-05-27 13:48 ` Philipp Stephani
  0 siblings, 2 replies; 13+ messages in thread
From: Theresa O'Connor @ 2017-05-05 17:51 UTC (permalink / raw)
  To: emacs-devel

hi all,

i wanted to write up two bugs in json.el that i haven't had a chance
to fix (in years, ooof). one is super minor and the other might
require a bit of thinking to come up with an elegant fix.

1. `json-skip-whitespace' uses a hardcoded list of whitespace
characters, which means it fails to skip over other WSpace=Y
characters. It should probably use `search-whitespace-regexp' from
isearch.el (or an equivalent value from elsewhere) instead.

2. Order of key-value pairs is not explicitly preserved in either the
reader or the serializer, and if there are duplicate keys, either the
first or the last wins depending on a number of factors. While json
objects are technically defined to be unordered (and therefore
json.el's current behavior is conforming), the standard JS
implementation preserves order and a convention has developed whereby
duplicate keys are used to provide "comments", e.g.

{
  "foo": "the foo property is used for blah blah blah.",
  "foo": 4
}

Last key should always win when reading, and order needs to be
preserved when serializing so that these "comments" can be generated.
This is a fairly serious interoperability issue.


thanks,
tess

p.s. for extra credit, if someone could s/Edward O'Connor/Theresa
O'Connor/g everywhere i would really appreciate it.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-05-29  0:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-05 17:51 two json.el bugs Theresa O'Connor
2017-05-05 18:44 ` Yuri Khan
2017-05-05 19:25   ` Drew Adams
2017-05-20 15:51   ` [PATCH] Fix definition of whitespace in JSON Philipp Stephani
2017-05-20 17:28     ` Dmitry Gutov
2017-05-21 21:03       ` Philipp Stephani
2017-05-27 13:32   ` two json.el bugs Philipp Stephani
2017-05-27 13:48 ` Philipp Stephani
2017-05-28  1:30   ` Drew Adams
2017-05-28 18:47     ` Philipp Stephani
2017-05-28 22:12       ` Drew Adams
2017-05-28 22:44         ` Bruce V Chiarelli
2017-05-29  0:42           ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).