Reputation: 5439
The vaules with @ are properties of the field street... I have never seen this before in json so and I am a little bit lost.
"street":{"$":"Stadhouderskade","@label":"Street","@id":"123"}
Same thing in XML will be:
<street id="123" label="Street">Stadhouderskade</street>
How can I get this field values using gson?
Upvotes: 0
Views: 217
Reputation: 46402
All values are properties of street, objects have nothing like XML does. In XML there are "two kinds of properties":
Unlike JSON this doesn't map to objects directly. So just use a FieldNamingStrategy which maps "$" to "name", and "@something" to "something" with a class like
class Street {
String name;
String label; // maybe should be omitted as "Street" is quite useless here
int id;
}
Or is there another problem with the JSON? What I wrote must be enough for the part shown.
Upvotes: 1