---
title: MetricReport.EncodingFormat
framework: metrickit
role: symbol
role_heading: Enumeration
path: metrickit/metricreport/encodingformat
---

# MetricReport.EncodingFormat

A value that controls the JSON structure used when encoding a metric report.

## Declaration

```swift
enum EncodingFormat
```

## Discussion

Discussion Set encodingFormatKey in a JSONEncoder’s userInfo dictionary to choose the encoding format before archiving reports: let encoder = JSONEncoder() encoder.userInfo[MetricReport.encodingFormatKey] = MetricReport.EncodingFormat.byStateReportingDomain let data = try encoder.encode(report) The .byStateReportingDomain format organizes metric values by MetricGroup, which can be more convenient for log pipelines that process one category at a time.

## Topics

### Encoding formats

- [MetricReport.EncodingFormat.default](metrickit/metricreport/encodingformat/default.md)
- [MetricReport.EncodingFormat.byStateReportingDomain](metrickit/metricreport/encodingformat/bystatereportingdomain.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Metric data

- [intervalEntries](metrickit/metricreport/intervalentries.md)
- [stateEntries](metrickit/metricreport/stateentries.md)
- [encodingFormatKey](metrickit/metricreport/encodingformatkey.md)
