We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
可以把GsonUtils也加进去
The text was updated successfully, but these errors were encountered:
这个不方便添加到 DevApp 库中,因为会依赖 Gson 且导致别人项目版本不一致,但是我有专门的 kotlin 库里面实现了。
// DevEngine - 第三方框架解耦、一键替换第三方库、同类库多 Engine 组件化混合使用 implementation 'io.github.afkt:DevEngine:1.0.8'
如何使用 Gson 可查看 json.kt 以下为使用示例:
// 初始化只需调用 DevEngine.completeInitialize(context) // 假设存在 User 实体类 val user = User() // 转换为 JSON 字符串 val json = user.toJson() // 映射为实体类 val user1 = json.fromJson( classOfT = User::class.java ) // 上面是最简单常见的使用,下面还有其他方法 // 转换为 JSON 字符串并进行格式化缩进 val json = user.toJsonIndent() // 判断字符串是否 JSON 格式 json.isJSON() // 判断字符串是否 JSON Object 格式 json.isJSONObject() // 判断字符串是否 JSON Array 格式 json.isJSONArray()
只要调用初始化 DevEngine.completeInitialize(context) 方法,无需考虑内部实现,默认使用 Gson 作为 JSON Engine 进行处理了。
DevEngine.completeInitialize(context)
Sorry, something went wrong.
No branches or pull requests
可以把GsonUtils也加进去
The text was updated successfully, but these errors were encountered: