This commit is similar to the previous one. This time it deals with functions related to stats JSON output.