A lightweight Objective-C library for mapping JSON dictionaries to NSObject properties using Key-Value Coding (KVC).
Motis is an Objective-C library that simplifies JSON-to-object mapping by using Cocoa's Key-Value Coding (KVC). It allows developers to define how JSON dictionary keys map to NSObject properties, automatically handling type conversions and validation. This eliminates repetitive parsing code and ensures type safety when working with JSON APIs.
iOS and macOS developers building Objective-C applications that consume JSON APIs and need to map responses to model objects efficiently.
Developers choose Motis for its lightweight approach, automatic type validation, and seamless integration with Core Data. Unlike heavier ORM solutions, it stays close to Cocoa conventions, offers fine-grained control via validation hooks, and reduces boilerplate without sacrificing flexibility.
Easy JSON to NSObject mapping using Cocoa's key value coding (KVC)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Each NSObject subclass defines its own JSON-to-property mapping via +mts_mapping, keeping mapping code modular and close to the model, as shown in the User class example.
Motis automatically validates and converts JSON strings, numbers, and dictionaries to native types like NSURL, NSDate, and NSData, reducing manual parsing boilerplate.
Supports nested JSON mapping using dot notation (e.g., 'user_stats.views') and array index access, enabling complex JSON structures without extra code.
Includes specific hooks and guidance for NSManagedObject subclasses, such as overriding -mts_willCreateObjectOfClass to handle managed object contexts.
Integrating with Core Data requires manual overrides like -mts_willCreateObjectOfClass for NSManagedObject instantiation, adding significant boilerplate and complexity.
Automatic date validation has no default NSDateFormatter; developers must provide one via +mts_validationDateFormatter, forcing extra setup for common use cases.
As an Objective-C library, it lacks native Swift support and relies on bridging headers, making it cumbersome for modern iOS projects transitioning to Swift.