refactor(toJson): remove breaking change from previous CL

Closes #10297