Document the stats side of JSON.
Minor tweaks based on actually reading the thing.
Various problems spotted by Matthias.
Merge bug25376
Merge heads of stable