Skip to content

对请求返回过来的json数据用json.decode(jsonString)的时候报错 #3

Closed

Description

@arden

我在用flutter写App的时候,对Api请求返回过来的json字符串用dart:convert里的json类调用json.decode(jsonString)的时候报错,说字符串不支持解码,你可以试一下。。。

Activity

  1. wendux commented on May 7, 2018

    @wendux
    Contributor

    首先请将dio升级到最新版本;
    其次, 如果服务器返回的是json数据(content-type:application/json)时,dio默认是自动调用Json.decode进行解码的,你可以直接使用,不需要再手动解码

  2. arden commented on May 7, 2018

    @arden
    Author

    可以了,我还以为要手动转为json数据了,谢谢。

  3. added a commit that references this issue on Feb 13, 2023
  4. added a commit that references this issue on Jun 11, 2025
  5. added a commit that references this issue on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions