为啥代码是对的,还是有报错

来源:5-2 实现24小时天气预报查询功能

慕码人4323451

2023-08-02 14:41

Exception in thread "main" java.lang.RuntimeException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

at com.imooc.weather.impl.WeatherUtilsImpl.w24h(WeatherUtilsImpl.java:82)

at com.test.weather.Application.main(Application.java:22)

Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

at com.google.gson.Gson.fromJson(Gson.java:944)

at com.google.gson.Gson.fromJson(Gson.java:897)

at com.google.gson.Gson.fromJson(Gson.java:846)

at com.imooc.weather.impl.WeatherUtilsImpl.w24h(WeatherUtilsImpl.java:60)

... 1 more

Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:386)

at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:183)

at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)

at com.google.gson.Gson.fromJson(Gson.java:932)

... 4 more


写回答 关注

0回答

还没有人回答问题,可以看看其他问题

Java入门第二季 升级版

课程升级!以终为始告别枯燥,在开发和重构中体会Java面向对象编程的奥妙

530553 学习 · 6091 问题

查看课程

相似问题