toJSON revisited