<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/JSONEncoder/OutputFormatting-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation11JSONEncoderC16OutputFormattingV"
  },
  "title" : "JSONEncoder.OutputFormatting"
}
-->

# JSONEncoder.OutputFormatting

The output formatting options that determine the readability, size, and element order of an encoded JSON object.

```
struct OutputFormatting
```

## Topics

### Formatting Output

[`prettyPrinted`](/documentation/Foundation/JSONEncoder/OutputFormatting-swift.struct/prettyPrinted)

The output formatting option that uses ample white space and indentation to make output easy to read.

[`sortedKeys`](/documentation/Foundation/JSONEncoder/OutputFormatting-swift.struct/sortedKeys)

The output formatting option that sorts keys in lexicographic order.

[`withoutEscapingSlashes`](/documentation/Foundation/JSONEncoder/OutputFormatting-swift.struct/withoutEscapingSlashes)

The output formatting option specifies that the output doesn’t prefix slash characters with escape characters.

### Creating Options

[`init(rawValue:)`](/documentation/Foundation/JSONEncoder/OutputFormatting-swift.struct/init(rawValue:))

Creates an OutputFormatting value with the given raw value.

[`rawValue`](/documentation/Foundation/JSONEncoder/OutputFormatting-swift.struct/rawValue)

The format’s default value.

[`init()`](/documentation/Foundation/JSONEncoder/init())

Creates a new, reusable JSON encoder with the default formatting settings and encoding strategies.

### Checking Options

### Adding and Removing Options

### Combining Options

### Comparing Options

### Supporting Types



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)