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

为啥toJSON方法转字典后,并不是自己创建的属性名 #470

Open
bruceFighting opened this issue Jul 7, 2022 · 5 comments
Open

Comments

@bruceFighting
Copy link

var wId : String? = ""

override func mapping(mapper: HelpingMapper) {
mapper <<<
self.wId <-- "id"
}

toJSON之后获取的key是“id”而不是wId,这么玩的吗

@wangwanjie
Copy link

var wId : String? = ""

override func mapping(mapper: HelpingMapper) { mapper <<< self.wId <-- "id" }

toJSON之后获取的key是“id”而不是wId,这么玩的吗

这是正确的

@stevendinggang
Copy link

stevendinggang commented Feb 17, 2023 via email

@bruceFighting
Copy link
Author

@wangwanjie
主要是我需要通过key来创建数据库的列,id与数据库的名字冲突了,不过后面解决了

@wangwanjie
Copy link

@wangwanjie 主要是我需要通过key来创建数据库的列,id与数据库的名字冲突了,不过后面解决了

现在怎么不用Codable

@YongTaiSin
Copy link

我也以为是这么玩的, 结果key是原始的

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

No branches or pull requests

4 participants