美文网首页
kotlin json解析(仿swiftJson)

kotlin json解析(仿swiftJson)

作者: 清风昕雨_f69d | 来源:发表于2019-08-28 17:09 被阅读0次

需要添加json implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.0.pr1'

1.基本类型 JsonParser.parse(jsonString)["num"].intValue 

2.对象 ListBean(json) 

3.list JsonParser.parse(jsonString)["list"].arrayValue.map { subJson -> ListBean(subJson) }

数据类 

class ListBean(json: Json) { 

var num:Int = json["num"].intValue 

var id :Int = json["id"].intValue

}

gitHub:https://github.com/hycinth/KotlinJson

邮箱:1093529347@qq.com

相关文章

网友评论

      本文标题:kotlin json解析(仿swiftJson)

      本文链接:https://www.haomeiwen.com/subject/juocrxtx.html