com.google.gson.JsonSyntaxException

java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1

Samebug tips2

Your json input might be invalid. Try checking it in a validator like https://jsonlint.com


poroszdporoszd

Your custom gson deserializer might have a bug. Try to write a unit test that checks proper deserialization of only that class by forging a json that contains a single field of that type.


poroszdporoszd

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web163

  • via Unknown by Unknown author,
  • Stack trace

    • com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 at com.google.gson.Gson.fromJson(Gson.java:815) at com.google.gson.Gson.fromJson(Gson.java:768) at com.google.gson.Gson.fromJson(Gson.java:717) at com.kosalgeek.android.json.JsonConverter.toArrayList(JsonConverter.java:42) at markjon.nobleza.qaldi.Table.onResponse(Table.java:51) at markjon.nobleza.qaldi.Table.onResponse(Table.java:20)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Atique AhemadAtique Ahemad
    Once,
    Hiren AmaliyarHiren Amaliyar
    Once,
    Unknown visitor
    Unknown visitorOnce,
    linxiaolonglinxiaolong
    4 times, last one
    Alexandru PopaAlexandru Popa
    5 times, last one
    14 more bugmates