An internal #Smithereen update: I replaced the org.json JSON library with gson. It allows for somewhat cleaner code with its JsonElement base class for everything, supports serializing/deserializing Java objects directly (will come in especially handy for when I'll be making the API!), and preserves a sane order of keys in objects. Yes, that last part is very important because it hurt to read the mess that came out of org.json.
Oh and I also made a pull request to gson: https://github.com/google/gson/pull/1900
Everyone was asking for this feature. Since 2008. SINCE 2008!!! But it was never added.