---
title: JSONSerialization.WritingOptions
framework: foundation
role: symbol
role_heading: Structure
path: foundation/jsonserialization/writingoptions
---

# JSONSerialization.WritingOptions

Options for writing JSON data.

## Declaration

```swift
struct WritingOptions
```

## Topics

### Creating a Writing Options Instance

- [init(rawValue:)](foundation/jsonserialization/writingoptions/init(rawvalue:).md)

### Formatting JSON

- [fragmentsAllowed](foundation/jsonserialization/writingoptions/fragmentsallowed.md)
- [prettyPrinted](foundation/jsonserialization/writingoptions/prettyprinted.md)
- [sortedKeys](foundation/jsonserialization/writingoptions/sortedkeys.md)
- [withoutEscapingSlashes](foundation/jsonserialization/writingoptions/withoutescapingslashes.md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Equatable](swift/equatable.md)
- [ExpressibleByArrayLiteral](swift/expressiblebyarrayliteral.md)
- [OptionSet](swift/optionset.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [SetAlgebra](swift/setalgebra.md)

## See Also

### Creating JSON Data

- [data(withJSONObject:options:)](foundation/jsonserialization/data(withjsonobject:options:).md)
- [writeJSONObject(_:to:options:error:)](foundation/jsonserialization/writejsonobject(_:to:options:error:).md)
- [isValidJSONObject(_:)](foundation/jsonserialization/isvalidjsonobject(_:).md)
