Document the stats side of JSON.
Minor tweaks based on actually reading the thing.
Various problems spotted by Matthias.
Merge bug25376
stable to default (with some changes to account for rates_mode changes that have happened since).
Merge heads of stable
Merge heads of default
stable to default