A Swift JSON serialization/deserialization library that works with pure Swift structs and classes without NSObject inheritance.
HandyJSON is a Swift library for serializing and deserializing JSON data to and from native Swift model objects (structs and classes). It solves the problem of cumbersome JSON mapping in Swift by using reflection to directly assign values to property memory, eliminating the need for NSObject inheritance or manual mapping functions.
iOS, macOS, watchOS, and tvOS developers working with Swift who need a lightweight, type-safe JSON library that integrates seamlessly with pure Swift types.
Developers choose HandyJSON because it offers a Swift-native approach to JSON handling—no NSObject subclassing, no boilerplate mapping code, and support for complex Swift types like enums and nested structs, making it more intuitive than many alternatives.
A handy swift json-object serialization/deserialization library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works seamlessly with Swift structs and classes without requiring NSObject inheritance or KVC, adhering to Swift's type safety and idiomatic design, as emphasized in the README.
Uses Swift runtime reflection to map JSON directly to property memory, eliminating the need for verbose manual mapping code and reducing boilerplate, which is a core feature highlighted.
Handles a wide range of Swift types including enums, optionals, collections, and nested objects, with built-in transformers for common types like Date and URL, as detailed in the Supported Property Type section.
Provides custom transformations and designated path parsing, allowing developers to handle complex JSON structures and specific mapping logic easily, with examples like TransformOf for enums.
Depends on Swift's internal memory layout, making it vulnerable to breaking changes with Swift language updates, as acknowledged in the README's note about following runtime changes closely.
Direct memory writing means that didSet and willSet observers are not triggered unless models use dynamic properties with NSObject, adding complexity for KVO needs, as explained in the FAQ.
Requires defining empty mapping functions in superclasses for inheritance to work properly, which can be intrusive and error-prone, as noted in the FAQ regarding mapping in inheritance objects.