LoginSignup
7
2

More than 5 years have passed since last update.

Expected BEGIN_OBJECT but was 〜

Posted at

こんな感じの fromJson() メソッドを良く見掛けて、どうやら HttpRequest のテンプレっぽいんだけどこれを
使用したコード中で Gson の処理がエラーになっていた。

Expected BEGIN_OBJECT というのは json のオブジェクト開始 { が来るはずというところで、そこに例えば json の
Array が来たりすると Expected BEGIN_OBJECT but was BEGIN_ARRAY というエラーになったりする。
Expected BEGIN_OBJECT but was STRING というと json じゃない文字列が渡って来ている様子。

どうもエラーから推測しにくくて詰まった。

参考

7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2