【问题标题】:JSON Object parsing problem in Android with Volley library使用 Volley 库的 Android 中的 JSON 对象解析问题
【发布时间】:2019-08-26 01:38:18
【问题描述】:

我正在尝试从服务器获取 JSON 响应,然后将其显示在我的 android 中,但由于解析错误而未能这样做

我的服务器响应 jsonformat= { "Result": "登录成功", “用户名:”:“Ayan” }

但在 android 中我无法获取第二个对象,它返回为 null

enter image description here

【问题讨论】:

    标签: arrays json parsing android-volley


    【解决方案1】:

    在您的回复中,您有“用户名:”之类的字段,还是您的回复写错了?

    JsonObject object = new JsonObject(response);
    String result = object.getString("Result");
    String userName = object.getString("User_Name:");
    

    检查这个@Ayan

    【讨论】:

      猜你喜欢
      • 2019-08-25
      • 1970-01-01
      • 2020-12-24
      • 2021-04-01
      • 1970-01-01
      • 2021-08-29
      • 2020-07-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多