alibaba / alibaba/HandyJSON

自定义属性映射时获取不到json字符串的值

Open
#308 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.3k
Forks
677
PR merge metrics
No merged PRs in 30d

Description

这个是我的属性 `var paramValues = MoLastUpdateTime()`

下面是我的自定义映射方法:
```
func mapping(mapper: HelpingMapper) {
mapper <<<
self.paramValues <-- TransformOf(fromJSON: { (string) -> MoLastUpdateTime? in
// 我在这里获取到的string值为nil,请问是不是我哪里写错了?(补充:我的json数据里面是有这个字段的)
}, toJSON: { (model) -> String? in

})
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the custom TransformOf mapping for paramValues and trace the JSON deserialization path to determine why the fromJSON closure receives nil even though the field is present. Reproduce the mapping with a JSON value for that field; done means the closure receives the expected string and the property is populated.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, swift
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.