Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
arden opened this issue May 6, 2018 · 2 comments
Closed

Comments

@arden
Copy link

arden commented May 6, 2018

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

@wendux
Copy link
Contributor

wendux commented May 7, 2018

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

@arden
Copy link
Author

arden commented May 7, 2018

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

@wendux wendux closed this as completed May 8, 2018
@fly512 fly512 mentioned this issue Jan 7, 2019
AlexV525 added a commit that referenced this issue Feb 13, 2023
Co-authored-by: Pem <antoinepemeja@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants