formatexception (formatexception: unexpected character (at character 1) json

戏子无情 提交于 2021-02-11 18:10:30

问题


**enter image description here**

The error as stated is: formatexception (formatexception: unexpected character (at character 1) json Is there a solution to this?


回答1:


Try this one bro

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



回答2:


As you can see in the Exception, you are getting HTML code instead of JSON in the response.body:

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

The solution would be to receive a JSON or to try to parse the HTML



来源:https://stackoverflow.com/questions/58264028/formatexception-formatexception-unexpected-character-at-character-1-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!