如何缓冲阅读器的字符串转换为JSON在android系统? [英] How to convert buffered-reader string to JSON in android ?

查看:146
本文介绍了如何缓冲阅读器的字符串转换为JSON在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了缓冲读者JSON响应。现在,如何缓冲阅读器的字符串转换成JSON?

我得到这样

字符串

  [
  {
    电子邮件:bhavumca@gmail.com
    密码:bhavesh @ 123#,
    角色:监视器,
    code:0
  }
]


解决方案

  JSONArray aardata =新JSONArray(您的缓冲读者字符串):

和解析

 的JSONObject的obj = arrdata.getJsonObject(0);      字符串email = obj.getString(电子邮件);

I get json response in Buffered Reader. Now How to convert buffered-reader string to JSON?

I get the String like

[
  {
    "email": "bhavumca@gmail.com",
    "password": "bhavesh@123#",
    "role": "monitor",
    "code": "0"
  }
]

解决方案

JSONArray aardata = new JSONArray(your buffered reader String):

And For Parse

  JSONObject obj = arrdata.getJsonObject(0);

      String email = obj.getString('email');

这篇关于如何缓冲阅读器的字符串转换为JSON在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆