alibaba / alibaba/HandyJSON

模型嵌套一个模型json转模型后,属性模型一直为空?

Open
#405 2 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

//b必须
class KIStudent: HandyJSON {
var type : String?
var iconName : KIStudent?
}

class Parent: HandyJSON {
var name : String?
var student : KIStudent?
}

let dictionary = ["name":"zd"."student": ["type":"1","iconName":"oppo"]]

if let parent = Parent.deserialize(from: dictionary) {
// …
parent.student //打印一直是nil

}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Swift snippet with Parent.deserialize(from:) and inspect how HandyJSON handles the nested student property. Trace the nested-model deserialization path and verify the result by checking that parent.student is populated with the supplied type and iconName values.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.