android - 如何从 json 对象中获取数据
问题描述
如何从给定 JSON 数据的 JSON 数据中获取特定的数据对象:
{
"customer":{
"id":1117198024800,
"email":"abc@gmail.com",
"accepts_marketing":false
}
}
我需要从上面的数据中解析ID,谁能帮帮我。提前致谢!!!
解决方案
If you will use it as string:
JSONObject reader = new JSONObject(data);
JSONObject customer = reader.getJSONObject("customer");
String id = (String) customer.getString("id");
推荐阅读
- javascript - Moment.duration():获取总天数
- python - 为什么在 matplotlib 中调整 scilimits 不能正常工作?
- django - django - keras - aws elastic beanstalk - 更新已部署应用程序的数据
- swift - 从 C# 中的 async/await 到 Swift 中的闭包
- c# - MVC Ajax 在点击事件上发布到控制器
- r - lm 回归问题
- react-native - 反应本机调试器 - 刷新应用程序时如何保存断点
- ruby-on-rails - 0.3576657234101671:Float 的未定义方法“调用”
- python - 如何使用另一个类的函数类?
- scripting - Mikrotik 通过打印发布数据