Tag

Codable

0 views collected around this technical thread.

NetEase Cloud Music Tech Team
NetEase Cloud Music Tech Team
Jul 15, 2022 · Mobile Development

Swift JSON Decoding Solutions: Comparison and Custom Implementation

The article surveys common Swift JSON decoding approaches—including manual Unbox, HandyJSON, Sourcery, built-in Codable and BetterCodable—highlights their strengths and weaknesses, then presents a custom NEJSONDecoder that adds default values, key mapping, type compatibility, tolerant error handling, and transformation support, with performance benchmarks.

BetterCodableCodableDecoder
0 likes · 23 min read
Swift JSON Decoding Solutions: Comparison and Custom Implementation
Sohu Tech Products
Sohu Tech Products
Nov 15, 2018 · Mobile Development

Using Swift Codable for JSON Encoding and Decoding: Features, Tips, and Advanced Scenarios

This article explains how Swift's Codable protocol simplifies converting between JSON and native data structures, covering basic usage, handling nested objects, optional values, key mapping, date formats, enums, dynamic payloads, and custom types for robust iOS development.

CodableJSONSwift
0 likes · 18 min read
Using Swift Codable for JSON Encoding and Decoding: Features, Tips, and Advanced Scenarios
Liulishuo Tech Team
Liulishuo Tech Team
Apr 19, 2018 · Mobile Development

Using Swift 4.1 JSONEncoder/JSONDecoder KeyEncodingStrategy to Bridge Snake_case and CamelCase and Create Custom Key Strategies

This article explains how Swift 4.0 introduced Codable, how Swift 4.1 added keyEncodingStrategy and keyDecodingStrategy to automatically convert between snake_case and camelCase, and how to implement custom key transformations such as PascalCase using the .custom strategy.

CodableJSONKeyEncodingStrategy
0 likes · 9 min read
Using Swift 4.1 JSONEncoder/JSONDecoder KeyEncodingStrategy to Bridge Snake_case and CamelCase and Create Custom Key Strategies