Transaction format for multiple inputs/outputs

How do I format a raw transaction with multiple inputs and/or outputs?