@@ -546,6 +546,14 @@ static force_inline id YYValueForMultiKeys(__unsafe_unretained NSDictionary *dic
propertyMeta->_mappedToKey = mappedToKey;
NSArray *keyPath = [mappedToKey componentsSeparatedByString:@"."];
+ for (NSString *onePath in keyPath) {
+ if (onePath.length == 0) {
+ NSMutableArray *tmp = keyPath.mutableCopy;
+ [tmp removeObject:@""];
+ keyPath = tmp;
+ break;
+ }
if (keyPath.count > 1) {
propertyMeta->_mappedToKeyPath = keyPath;
[keyPathPropertyMetas addObject:propertyMeta];
@@ -147,6 +147,10 @@
model = [YYTestPropertyMapperModelCustom yy_modelWithJSON:json];
XCTAssertTrue([model.desc4 isEqualToString:@"Apple"]);
+ json = @"{\".ext\":\"Apple\", \"name\":\"Apple\", \"count\":\"10\", \"desc1\":\"Apple\", \"desc2\":\"Apple\", \"desc3\":\"Apple\", \"desc4\":\"Apple\", \"modelID\":\"Apple\"}";
+ model = [YYTestPropertyMapperModelCustom yy_modelWithJSON:json];
+ XCTAssertTrue([model.desc4 isEqualToString:@"Apple"]);
+
json = @"{\"id\":\"abcd\"}";
XCTAssertTrue([model.modelID isEqualToString:@"abcd"]);