Writes a keyed list of items out as a document in one of the supported formats. Selection and patching are the pair for editing a document that already exists, while this one builds a document from data that never was one, which is what a workflow needs once it has assembled the entries itself. Every key and value is escaped for the format being written, so a value holding a separator, a quote, a backslash, or a line break survives a round trip.