formatexception(formatexception:意外字符(在字符1处)json

时间:2019-10-07 05:42:11

标签: php mysql json mobile flutter

**enter image description here**

所述错误为: formatexception(formatexception:意外字符(在字符1处)json 有解决办法吗?

2 个答案:

答案 0 :(得分:0)

尝试这个兄弟

final response = await http.post("url", body{
  'username': username,
  'password': password,
},
header{
  'accept':'*/*'
});

答案 1 :(得分:0)

您可以在Exception中看到,您在response.body中获取的是HTML代码而不是JSON:

<!DOCTYPE html PUBLIC "~//W3C/DTD XHTML 1.0 Strict//EN" "http://www.w3.org...

解决方案是接收JSON或尝试解析HTML