added toJSON behavior.