Ensured that a toJSON method exists on sub-objects instead of just checking that the sub-object was truthy