TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2015 |
Maintained by Elvis Nuñez, Jacob Andersson, Hyper Interaktiv AS.
Mincing is a food preparation technique in which food ingredients are finely divided into uniform pieces.
Minced converts JSON keys to camelCase an adds support for replacement of JSON null values with empty strings.
This is especially useful as a workaround for avoiding crashes due to null values when using Realm. More info: Issue #628
// Converts all the keys in the JSON to camelCase
- (id)minced_JSONKeys;
- (NSArray *)minced_JSONObjectsKeys;
- (NSDictionary *)minced_JSONObjectKeys;
// Converts all the keys in the JSON to camelCase and replaces null values with an empty string
- (id)minced_JSONKeysWithNonnulls;
- (NSArray *)minced_JSONObjectsKeysWithNonnulls;
- (NSDictionary *)minced_JSONObjectKeysWithNonnulls;
[
{
"created_at":null,
"updated_at":"2015-03-11",
"window":{
"title":null,
"name":"hyper_window"
}
},
{
"created_at":null,
"updated_at":"2015-03-12",
"panel":{
"title":null,
"name":"hyper_panel"
}
}
]
NSArray *mincedJSON = [JSON minced_JSONObjectsKeysWithNonnulls];
// Realm
RLMRealm *realm = [RLMRealm defaultRealm];
[realm beginWriteTransaction];
[self createOrUpdateInDefaultRealmWithObject:mincedJSON];
[realm commitWriteTransaction];
[
{
"createdAt":"",
"updatedAt":"2015-03-11",
"window":{
"title":"",
"name":"hyper_window"
}
},
{
"createdAt":"",
"updatedAt":"2015-03-12",
"panel":{
"title":"",
"name":"hyper_panel"
}
}
]
Minced is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Minced'
Hyper Interaktiv AS, [email protected]
Minced is available under the MIT license. See the LICENSE file for more info.