简体   繁体   English

在 flutter 中显示来自 API 响应的完整 json 数据

[英]Display the complete json data from API response in flutter

I'm getting the json data from the API call but its not displaying the complete data.There are a lot of properties to work with and creating the model would be difficult as it's my first time working on any API.So i wanted to use app.quicktype.io to parse the json data directly into dart code for which i need to get the complete json data.Right now only little bit of the json data is being displayed in the console. I'm getting the json data from the API call but its not displaying the complete data.There are a lot of properties to work with and creating the model would be difficult as it's my first time working on any API.So i wanted to use app.quicktype.io to parse the json data directly into dart code for which i need to get the complete json data.Right now only little bit of the json data is being displayed in the console.

CODE:代码:

Future<void> getContacts() async {
    var client = http.Client();
    String contacts_url =
        'https://mylinkexample.com';
    String basicAuth =
        'Basic mykeyexampele';
    var response = await client.get(contacts_url,
        headers: <String, String>{'authorization': basicAuth});
    var jsonString = jsonDecode(response.body);
    print(response.statusCode);
    print(jsonString);
  }

Use this:用这个:

import 'dart:developer' as developer;

test() {
  developer.log(response.body);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM