Adding total counts to json responses.