Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.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
Flutter 从Internet获取嵌套数据_Flutter - Fatal编程技术网

Flutter 从Internet获取嵌套数据

Flutter 从Internet获取嵌套数据,flutter,Flutter,如何获取嵌套json响应?我可以获取直接值,但无法获取嵌套值 { "username":"aa", "data":{ "key":"value", "anotherKey":"anotherValue" } } 您必须首先像这样解码json- var respBody = jsonDecode(response.body); 然后您可以使用respBody[“数据”][“键”]

如何获取嵌套json响应?我可以获取直接值,但无法获取嵌套值

{
 "username":"aa",
 "data":{
          "key":"value",
          "anotherKey":"anotherValue"
        }
}

您必须首先像这样解码json-

var respBody = jsonDecode(response.body);
然后您可以使用
respBody[“数据”][“键”]