Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用java解析JSON_Java_Android_Json - Fatal编程技术网

用java解析JSON

用java解析JSON,java,android,json,Java,Android,Json,我试图在android中解析JSON,但在访问对象的子对象时遇到了问题。我试图从以下内容中提取augment {"augment-list": { "time": "12:01", "channel": "channel1", "augment": [ {"id": "123", "name": "here", "x": "5", "y": "10", "orientation": "up", "content": "some stuff"}, {"id"

我试图在android中解析JSON,但在访问对象的子对象时遇到了问题。我试图从以下内容中提取augment

{"augment-list": {
  "time": "12:01",
  "channel": "channel1",
    "augment": [
      {"id": "123", "name": "here", "x": "5", "y": "10", "orientation": "up", "content": "some stuff"},
      {"id": "456", "name": "there", "x": "12", "y": "25", "orientation": "down", "content": "more stuff"},
      {"id": "789", "name": "over there", "x": "1", "y": "2", "orientation": "left", "content": "and more"}
    ]
}}

我尝试通过获取名为augment或augment[0]的augment list的JSON对象来访问augment,但无法理解如何访问其中的每个augment

如果没有更多的细节,我不知道问题出在哪里。你有错误吗?你能发一些代码吗

有这样的吗

json.getJSONObject("augment-list").getJSONArray("augment").getJSONObject(0).getInt("id")