I have a JSON object that looks like this
{
\"foo\":{
\"bar\":\"bar\",
\"echo\":\"echo\"
}
}
But then my Java object looks
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Example {
@SerializedName("foo")
@Expose
private Foo foo;
public Foo getFoo() {
return foo;
}
public void setFoo(Foo foo) {
this.foo = foo;
}
}
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Foo {
@SerializedName("bar")
@Expose
private String bar;
@SerializedName("echo")
@Expose
private String echo;
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public String getEcho() {
return echo;
}
public void setEcho(String echo) {
this.echo = echo;
}
}
you can find more details here