---
title: "encode(to:)"
framework: Siri Evaluations
role: symbol
role_heading: Instance Method
platforms: [iOS 27.3+, iPadOS 27.3+, macOS 27.3+, visionOS 27.3+]
path: "sirievaluations/siriscenario/encode(to:)"
---

# encode(to:)

The scenario’s own fields, plus the utterances as one line.

## Declaration

```swift
func encode(to encoder: any Encoder) throws
```

## Discussion

Discussion The line is written as input. The evaluation runner stores the whole scenario in the report’s Input column, and Xcode shows a sample’s input field when it has one. Without it, Xcode prints the scenario’s entire JSON. Decoding is unchanged (it is synthesized, over CodingKeys), so a scenario file with or without input reads the same.
