We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我有一个值为数组类型的json数据,例如:{"array":[1,2,3,4,5,6,7,8,9]} ,json数组中为 Number 类型,我想转换为 NSString 类型; Model.h 声明 @property (nonatomic, copy) NSArray<NSString *> *array;
@property (nonatomic, copy) NSArray<NSString *> *array;
.m 实现方法: +(nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass { return @{@"array" : [NSString class]}; }
+(nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass { return @{@"array" : [NSString class]}; }
但是转换后得到的 self.array 一直为一个空数组,不写 modelContainerPropertyGenericClass 方法或者类型制定为 {@"array" : [NSNumber class]} 可以正常获取数据,但不是想要的类型。 期待回复,谢谢!
modelContainerPropertyGenericClass
{@"array" : [NSNumber class]}
The text was updated successfully, but these errors were encountered:
可能是个 Bug,稍后看一下。
Sorry, something went wrong.
NSURL
遇到相似的问题,解析结果为空数组,我的情况是:JSON数组为String类型,我想转换成Number类型!
现在依旧有这个问题,什么时候能修复一下?
modelCustomWillTransformFromDictionary里面处理一下原json (
modelCustomWillTransformFromDictionary
Successfully merging a pull request may close this issue.
我有一个值为数组类型的json数据,例如:{"array":[1,2,3,4,5,6,7,8,9]} ,json数组中为 Number 类型,我想转换为 NSString 类型;
Model.h 声明
@property (nonatomic, copy) NSArray<NSString *> *array;
.m 实现方法:
+(nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass { return @{@"array" : [NSString class]}; }
但是转换后得到的 self.array 一直为一个空数组,不写
modelContainerPropertyGenericClass
方法或者类型制定为{@"array" : [NSNumber class]}
可以正常获取数据,但不是想要的类型。期待回复,谢谢!
The text was updated successfully, but these errors were encountered: