seth/ej — pull request #9 by seth (2013-09-27 16:26:00+00:00)
Title: Add ej:dedup/1 to remove duplicate object keys from EJSON

RFC4627 states that JSON objects SHOULD have unique keys.
While uncommon and generally A Horrible Thing, this means we will
encounter JSON with duplicated object keys. The EJSON
representation uses proplists and will carry duplicates without
warning. The jiffy application happily encodes and decodes JSON with
dup keys.

Since some JSON libraries throw an exception when encountering
duplicate key Horribleness and since you might want to attempt to
reduce the Horribleness in the world, you can use ej:dedup/1 to
recurse through an EJSON term and remove duplicate keys. The
implementation uses lists:ukeysort/2 and therefore removes all but the
first occurance of a key and has the side effect of sorting the
proplists in EJSON objects.