Here is an updated patch. It now ignores duplicated keys in objects represented by alists and plists, just like the old encoder. (I didn't include this in the first draft out of fear it would be slow and complicated, but it turned out just to be complicated.) The performance is still acceptable, which means at least 2x the speed of the Jansson-based encoder.