Yes, you can. However, depending on the size of your onion, it could take longer to roast them. Use visual cues for doneness. They are done when they are softened, look caramelized, and turned lightly golden browned.