SERVER-13707 simplify tojsonObject

(cherry picked from commit 68c2f37993d8abb7d35a61eb79c7e0e16d021f68)