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

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.

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

Solutions on the web819

  • via GitHub by m1ci
    , 8 months ago
    java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
  • java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
  • via GitHub by angelnc1989
    , 8 months ago
    java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1
  • 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)

    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

    Once, 2 weeks ago
    Once, 2 months ago
    Unknown user
    Once, 6 months ago
    4 times, 7 months ago
    5 times, 8 months ago
    14 more bugmates