Use Gson to format/parse documents rather than StringBuilder/Scanner
Except for unit tests, we're formatting and parsing JSON documents ourselves using classes like StringBuilder and Scanner. This was the quickest way for me to produce a running prototype back in 2011, and it scaled surprisingly well. But there are several reasons for finally switching to a JSON library: less code, fewer bugs, and potentially better performance. The most recent hack for #11350 (moved) made me think that we finally have to switch to Gson for formatting and parsing all our JSON documents.
The following classes should be (de-)serialized using Gson: