emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

two json.el bugs


From: Theresa O'Connor
Subject: two json.el bugs
Date: Fri, 5 May 2017 10:51:44 -0700

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]