Simplest Gson.fromJson example fails
android, gson
Solution
Declare your class `retVal` outside the method.
Problem
Given the following code: ``` final class retVal { int photo_id; } Gson gson = new Gson(); retVal ret = gson.fromJson("{\"photo_id\":\"383\"}", retVal.class); ``` I get `ret` set to `null`. I'm sure I've missed something obvious out, as `toJson` with a class also fails, although hand-construction through `JsonObject` works.