You parse a property as a NSDictionary object in a MTLModel object, and then, you get the keys with allkeys
method.
@interface SomeModel : MTLModel<MTLJSONSerializing>
@property (copy, nonatomic, readonly) NSDictionary *dictionary;
@end
...
NSArray *keys = [dictionary allkeys];
The returned keys are not usually sorted the same way they came in the HTTP response body.
For instance, the http response is this:
{"someObject":{"key1": "valueOfKey1", "key2": "valueOfKey2", "key3": "valueOfKey3",}}
but then, the NSDictionary keys are returned like this:
{"key2", "key1", "key3"}
How can you get the keys sorted as they came?
I have personally tested this, but it doesn't work:
[[dict allKeys] sortedArrayUsingSelector: @selector(compare:)];