Skip to content
New issue

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 数组中类型转换错误 #190

Open
xfdev opened this issue Jan 9, 2017 · 4 comments · May be fixed by #281
Open

json 数组中类型转换错误 #190

xfdev opened this issue Jan 9, 2017 · 4 comments · May be fixed by #281
Labels

Comments

@xfdev
Copy link

xfdev commented Jan 9, 2017

我有一个值为数组类型的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]} 可以正常获取数据,但不是想要的类型。
期待回复,谢谢!

@ibireme ibireme added the bug label Aug 6, 2017
@ibireme
Copy link
Owner

ibireme commented Aug 6, 2017

可能是个 Bug,稍后看一下。

@cooaer
Copy link

cooaer commented Apr 9, 2018

遇到相似的问题,解析结果为空数组,我的情况是:JSON数组为String类型,我想转换成Number类型!

@dev-dylan
Copy link

现在依旧有这个问题,什么时候能修复一下?

@fanyuecheng
Copy link

modelCustomWillTransformFromDictionary里面处理一下原json (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants