当前位置: 代码迷 >> 综合 >> Gson 解析时候报错: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
  详细解决方案

Gson 解析时候报错: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $

热度:86   发布时间:2023-12-16 15:41:34.0


03-17 23:05:00.373 18335-18335/? E/AndroidRuntime: FATAL EXCEPTION: main
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime: Process: tech.androidstudio.jsongsondemo, PID: 18335
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{tech.androidstudio.jsongsondemo/tech.androidstudio.jsongsondemo.MainActivity}: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2314)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2386)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:148)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5310)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
03-17 23:05:00.373 18335-18335/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
03-17 23:05:00.373 18335-18335/?
  相关解决方案