---
title: Archives and Serialization
framework: foundation
role: collectionGroup
role_heading: API Collection
path: foundation/archives-and-serialization
---

# Archives and Serialization

Convert objects and values to and from property list, JSON, and other flat binary representations.

## Overview

Overview Use these APIs to convert your app’s in-memory types to representations suitable for serialization over I/O and network interfaces or to long-term storage. In Swift, the standard library defines the Encodable, Decodable, and Codable types, along with Encoder and Decoder APIs to perform encoding and decoding, as described in Encoding, Decoding, and Serialization. Foundation extends this with the EncodableWithConfiguration and DecodableWithConfiguration protocols, used for types that require additional static information to encode and decode, such as AttributedString. In Objective-C, NSCoding defines a protocol for encoding and decoding objects. When adding serialization to your own types, you should also adopt NSSecureCoding. This protocol adds protection against security vulnerabilities introduced by instantiating arbitrary objects as part of the decoding process. Many system frameworks use these types. When working with external systems, such as URL endpoints, use the JSON and XML APIs to serialize your app’s types to standard formats.

## Topics

### Adopting Codability

- [Encoding and Decoding Custom Types](foundation/encoding-and-decoding-custom-types.md)
- [Codable](swift/codable.md)
- [NSCoding](foundation/nscoding.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

### Serializing Arbitrary Payloads

- [CodableWithConfiguration](foundation/codablewithconfiguration.md)
- [CodableConfiguration](foundation/codableconfiguration.md)
- [DecodableWithConfiguration](foundation/decodablewithconfiguration.md)
- [DecodingConfigurationProviding](foundation/decodingconfigurationproviding.md)
- [EncodableWithConfiguration](foundation/encodablewithconfiguration.md)
- [EncodingConfigurationProviding](foundation/encodingconfigurationproviding.md)

### JSON

- [Using JSON with custom types](foundation/using-json-with-custom-types.md)
- [JSONEncoder](foundation/jsonencoder.md)
- [JSONDecoder](foundation/jsondecoder.md)
- [JSONSerialization](foundation/jsonserialization.md)

### Property Lists

- [PropertyListEncoder](foundation/propertylistencoder.md)
- [PropertyListDecoder](foundation/propertylistdecoder.md)
- [PropertyListSerialization](foundation/propertylistserialization.md)

### XML

- [XML Processing and Modeling](foundation/xml-processing-and-modeling.md)

### Keyed Archivers

- [NSKeyedArchiver](foundation/nskeyedarchiver.md)
- [NSKeyedArchiverDelegate](foundation/nskeyedarchiverdelegate.md)
- [NSKeyedUnarchiver](foundation/nskeyedunarchiver.md)
- [NSKeyedUnarchiverDelegate](foundation/nskeyedunarchiverdelegate.md)
- [NSCoder](foundation/nscoder.md)
- [NSSecureUnarchiveFromDataTransformer](foundation/nssecureunarchivefromdatatransformer.md)

### Deprecated

- [NSArchiver](foundation/nsarchiver.md)
- [NSUnarchiver](foundation/nsunarchiver.md)

## See Also

### Files and Data Persistence

- [File System](foundation/file-system.md)
- [Settings](foundation/settings.md)
- [Spotlight](foundation/spotlight.md)
- [iCloud](foundation/icloud.md)
- [Optimizing Your App’s Data for iCloud Backup](foundation/optimizing-your-app-s-data-for-icloud-backup.md)
