---
title: encodingFormatKey
framework: metrickit
role: symbol
role_heading: Type Property
path: metrickit/metricreport/encodingformatkey
---

# encodingFormatKey

A CodingUserInfoKey for selecting the JSON encoding format of a metric report.

## Declaration

```swift
static let encodingFormatKey: CodingUserInfoKey
```

## Mentioned in

Analyzing app performance with MetricKit

## Discussion

Discussion Set this key in a JSONEncoder’s userInfo dictionary before encoding a MetricReport to control the JSON output structure: let encoder = JSONEncoder() encoder.userInfo[MetricReport.encodingFormatKey] = MetricReport.EncodingFormat.byStateReportingDomain let data = try encoder.encode(report) When omitted, the encoder uses the default format.

## See Also

### Metric data

- [intervalEntries](metrickit/metricreport/intervalentries.md)
- [stateEntries](metrickit/metricreport/stateentries.md)
- [MetricReport.EncodingFormat](metrickit/metricreport/encodingformat.md)
