TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2015 |
Maintained by Elvis Nuñez.
This is a category on NSDictionary that converts the flat relationships in a dictionary to a nested attributes format.
NSDictionary *dictionary = @{@"first_name" : @"Chris",
@"contacts[0].name" : @"Tim",
@"contacts[0].phone_number" : @"444444",
@"contacts[1].name" : @"Johannes",
@"contacts[1].phone_number" : @"555555"};
NSDictionary *nestedAttributesDictionary = [dictionary hyp_JSONNestedAttributes];
"first_name": "Chris",
"contacts": [
{
"name": "Tim",
"phone_number": "444444"
},
{
"name": "Johannes",
"phone_number": "555555"
}
]
NSDictionary *dictionary = @{@"first_name" : @"Chris",
@"contacts[0].name" : @"Tim",
@"contacts[0].phone_number" : @"444444",
@"contacts[1].name" : @"Johannes",
@"contacts[1].phone_number" : @"555555"};
NSDictionary *nestedAttributesDictionary = [dictionary hyp_railsNestedAttributes];
"first_name": "Chris",
"contacts_attributes": {
"0": {
"name": "Tim",
"phone_number": "444444"
},
"1": {
"name": "Johannes",
"phone_number": "555555"
}
}
NSDictionary-HYPNestedAttributes is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'NSDictionary-HYPNestedAttributes'
Hyper Interaktiv AS, [email protected]
NSDictionary-HYPNestedAttributes is available under the MIT license. See the LICENSE file for more info.