serialize webidl output before writing