从JsonArray获取数据

时间:2017-09-12 09:18:34

标签: android

这是我打印日志时的JSON结果。我无法从此结果中获取数据。请建议如何从此结果中获取数据。错误显示类型为org.json.JSONArray无法转换为JSONObject。我知道已经有很多与此相关的帖子,但我无法理解如何获取数据。

09-12 05:12:57.606: W/System.err(3385): org.json.JSONException: Value 
[
  {
    "client": [
      {
        "office_name": "",
        "is_verified": "1",
        "forum_email_notification": "1",
        "city": "",
        "first_name": "Pratik",
        "balance": "0",
        "option_domain_name": "Vision",
        "initials": "Mr",
        "client_type": "0",
        "group_credit": "0.00",
        "gender": "0",
        "is_approved": "1",
        "domain_name": "Vision",
        "client_id": "2",
        "otherim": "",
        "credit": "0.00",
        "is_spam": "0",
        "office_phone": "",
        "parent_id": "0",
        "domain_url": "http://example.com/vision4/sandip/v5/",
        "fax": "",
        "forum_signature_content": "",
        "group_id": "1",
        "optionB_domain_id": "1",
        "country": "",
        "contact_number": "",
        "user_name": "test",
        "email": "pratik@test.com",
        "job_title": "",
        "last_name": "T",
        "parent_name": "",
        "temporary_address": "",
        "facebook_id": "",
        "language": "1",
        "office_contact_num": "",
        "salt": "e2e838b89b16f488a901b3b364ad839e",
        "zip_code": "",
        "office_website": "",
        "department": "",
        "state": "",
        "office_fax": "",
        "login_as": "0",
        "currency": "USD",
        "permanent_address": "",
        "department_access": "0",
        "is_manager": "0",
        "birthdate": "",
        "registration_date": "1504254310",
        "parent_email": "",
        "password_auth": "0",
        "group_name": "Default",
        "netmeetingid": "",
        "website": "",
        "domain_id": "1",
        "is_banned": "0",
        "twitter_id": "",
        "mobile_number": "",
        "office_address": "",
        "authentication": "383Y4A==",
        "harvest_id": "0",
        "image_path": "",
        "office_email": ""
      }
    ],
    "unsolve": 3,
    "solve": 0
  }
]
of type org.json.JSONArray cannot be converted to JSONObject

1 个答案:

答案 0 :(得分:0)

这是因为你的结果是一个JSONObject数组,而不是一个JSONObject本身