SERVER-8287: reduce excessive memory consumption by the shell's tojson() helper