One Logo Pool Ball
Foundation · IOS API REFERENCE

JSONEncoder.OutputFormatting

struct · iOS 8.0+ · SDK 27.1

struct OutputFormatting

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

Members (5)

get · iOS 11.0+

sortedKeys

TypeScript
get sortedKeys(): JSONEncoder_OutputFormatting
Swift declaration
static let sortedKeys: JSONEncoder.OutputFormatting

The output formatting option that sorts keys in lexicographic order.

get · iOS 8.0+

prettyPrinted

TypeScript
get prettyPrinted(): JSONEncoder_OutputFormatting
Swift declaration
static let prettyPrinted: JSONEncoder.OutputFormatting

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

get · iOS 13.0+

withoutEscapingSlashes

TypeScript
get withoutEscapingSlashes(): JSONEncoder_OutputFormatting
Swift declaration
static let withoutEscapingSlashes: JSONEncoder.OutputFormatting

The output formatting option specifies that the output doesn't prefix slash characters with escape characters. By default slashes get escaped ("/" -> "\/", "http://apple.com/" -> "http:\/\/apple.com\/") for security reasons, allowing outputted JSON to be safely embedded within HTML/XML. In contexts where this escaping is unnecessary, the JSON is known to not be embedded, or is intended only for display, this option avoids this escaping.

init · iOS 8.0+

init

TypeScript
init(rawValue: number): JSONEncoder_OutputFormatting
Swift declaration
init(rawValue: UInt)

Creates an OutputFormatting value with the given raw value.

get · iOS 8.0+

rawValue

TypeScript
getRawValue($self: JSONEncoder_OutputFormatting): number
Swift declaration
let rawValue: UInt

The format's default value.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →