얘들 없음 값은 프로젝트의 도움 덕분에 내가 내가 username
가지고 접근을 시도 할 때 내 JSON 데이터org.json.JSONException : 사용자 정의
{"time": "1422282109", "time_pretty": "Mon Jan 26 2015, 6:21am", "time_total": "10", "ip_address": "107.5.167.0", "uid": "1692954453", "session_id": "1094364389", "actions": "1", "total_visits": "2", "first_visit": {}, "landing_page": "http://clicky.com/blog/", "web_browser": "Safari 8.0", "operating_system": "Mac OS X", "screen_resolution": "1280x800", "javascript": "1", "language": "English", "geolocation": "Macomb, MI, USA", "country_code": "us", "latitude": "42.6735", "longitude": "-82.9165", "hostname": "comcast.net", "organization": "Comcast Cable", "custom": { "username": "finnllow" }
이
같은 오류가 발생했습니다 이 같은 오류는
오류
내가 직접 JSON 객체를 시도하지만이 오류가JSONArray cus = vvObj.getJSONArray(TAG_OBJ_CUSTOM);
String getUserName = "";
for (int f = 0; f < cus.length(); f++) {
JSONObject cud = cus.getJSONObject(f);
getUserName = cud.getString(TAG_OBJ_USERNAME);
}
691,363,210
org.json.JSONException: Value {"username":"jprezzi"} at custom of type org.json.JSONObject cannot be converted to JSONArray
내 코드
org.json.JSONException:no value for custom
코드
JSONObject cutom = vvObj.getJSONObject("custom");
String name = custom.getString("username");
편집 난 내 문제는 문제에 때때로
를 해결 가지고 username
값이 오류
optString
을 사용하기위한 값은 JSON 데이터에 설정되어 있지 않은 키
도움을 주셔서 감사하지만 지금은 오류'org.json.JSONException 받고 있어요 : username' –
에 대한 어떠한 값이 나타납니다없는 것처럼 오브젝트 당신 구문 분석에 해당 키가 없습니다. 디버거를 연결하고 json 객체에 포함 된 것을 보았습니까? 그렇지 않으면 다음을 수행하여 주 json 객체에 "사용자 정의"키가 있는지 확인할 수 있습니다.'if (json.has ("custom")) {/ * 사용자 이름 얻기 * /}' –
예. 일부 개체 덕분에 설명을 –