여러 번 묻지 만 제공되는 솔루션이 내 경우에는 작동하지 않는다는 것을 알고 있습니다. JSON Array에서 문자열 값을 가져 오는 방법은 무엇입니까?
는 여기가 웹 서비스 나 attXXXXXX이며, 여기에 내 코드 인 ID 값을 찾을 필요가{
"size": 1,
"_links": {
"context": "XXXX",
"self": "XXXXXX",
"base": "XXXXXX"
},
"start": 0,
"limit": 50,
"results": [
{
"container": {
"extensions": {
"position": "none"
},
"_links": {
"webui": "XXXX",
"tinyui": "XXXX",
"self": "XXXXXX"
},
"id": "XXXXX",
"type": "page",
"title": "XXXXX",
"_expandable": {
"container": "XXXXX",
"metadata": "",
"operations": "",
"children": "XXXX/child",
"history": "XXXX/history",
"ancestors": "",
"body": "",
"version": "",
"descendants": "XXXXX/descendant",
"space": "XXXXX"
},
"status": "current"
},
"metadata": {
"mediaType": "text/plain",
"comment": ""
},
"extensions": {
"fileSize": 8,
"mediaType": "text/plain",
"comment": ""
},
"_links": {
"download": "/download/attachments/XXXXX/MyData1.txt?version=1&modificationDate=1483652732000&api=v2",
"webui": "XXXXX",
"self": "XXXXX"
},
"id": "attXXXXXX",
"type": "attachment",
"title": "MyData1.txt",
"_expandable": {
"operations": "",
"children": "XXXX",
"history": "XXXXX",
"ancestors": "",
"body": "",
"descendants": "XXXXX",
"space": "XXXXX"
},
"version": {
"number": 1,
"minorEdit": false,
"by": {
"profilePicture": {
"path": "XXXXX",
"isDefault": true,
"width": 48,
"height": 48
},
"displayName": "XXXXX",
"type": "known",
"userKey": "XXXXX",
"username": "XXXXX"
},
"message": "",
"when": "2017-01-05T16:45:32.000-05:00"
},
"status": "current"
}
]
}
에서 응답으로 무엇입니까 내 JSON이다.
JSONObject page = new JSONObject(pageObj);
JSONArray jsonArray= page.getJSONArray("results");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject explrObject = jsonArray.getJSONObject(i);
}
그러나 jsonArray의 아이폰에 다른 게시물 제공된 모든 용액은 1이기 때문에, 상기 루프 번만 실행은 JSON 배열의 반복, 즉 동일하다. 내가 놓친 게 있니? 제안?
Java로 작업하는 것처럼 보이지만 'json'으로 질문 만 태그 지정했습니다. 사용중인 기본 기술 및 json 라이브러리에 대한 태그를 포함 할 수 있습니까? –
PHP를 사용하는 경우 Json 디코드는 일반 PHP 객체로 변환합니다. 그런 다음 그 지점의 값으로 참조하십시오. – DEVPROCB
태그를 더 추가했습니다 .. – Naseem