A fast, convenient, and nonintrusive Objective-C framework for converting between JSON and model objects.
MJExtension is an Objective-C framework that provides fast and convenient conversion between JSON data and native model objects. It solves the problem of writing repetitive parsing code by automatically mapping dictionary keys to model properties, supporting complex nested structures and custom transformations. Its nonintrusive design means models require no base class inheritance or source modifications.
iOS and macOS developers working with Objective-C who need to parse JSON APIs, handle network responses, or serialize model data. It's particularly useful for projects with complex data models or those integrating with Core Data.
Developers choose MJExtension for its exceptional speed, ease of use, and nonintrusive approach—eliminating boilerplate while maintaining full control over model classes. It offers a comprehensive feature set for real-world JSON handling without the overhead of larger libraries.
A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Models don't need to inherit from a base class or modify source files, allowing seamless integration into existing Objective-C codebases without architectural changes, as highlighted in the Nonintrusive Design feature.
Handles complex scenarios like nested models, model arrays, and multi-level key paths with simple API calls, such as using mj_setupObjectClassInArray for array mappings, demonstrated in the examples section.
Provides one-line implementations for NSCoding and NSSecureCoding through macros like MJCodingImplementation, making object serialization straightforward without writing boilerplate code, as shown in the Coding and Secure Coding sections.
Allows custom logic for converting values, such as string dates to NSDate or handling nil values, via methods like mj_newValueFromOldValue, offering fine-grained control over the mapping process, detailed in the NSString -> NSDate example.
Using MJExtension in Swift requires adding @objc or @objcMembers attributes and dynamic for basic types with default values, which is verbose and contrary to Swift's idioms; the README even recommends KakaJSON for Swift projects.
Relies on Objective-C runtime for property mapping, leading to performance overhead and lack of compile-time safety compared to Swift's Codable, making it less suitable for large-scale Swift applications.
Configuring advanced mappings, such as nested arrays or custom key paths, requires extra setup code like mj_setupObjectClassInArray, which can be error-prone and less intuitive than declarative approaches in modern frameworks.