-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hi,
I receive this JSON:
{
"data": [{
"type": "place",
"id": "00d66be8-7315-4f75-9dc1-7dc737a055ef",
"attributes": {
"name": "Test Pharmacy",
"lat": 42.394898,
"lng": 2.151117,
"image_url": "",
"user_distance": 0.03
},
"relationships": {
"place_address": {
"data": {
"type": "place_address",
"id": "00d66be8-7315-4f75-9dc1-7dc737a055ef"
}
}
}
}, {
"type": "place",
"id": "6f781c99-c991-442f-ae14-9630ee475f41",
"attributes": {
"name": "Farmacia Test",
"lat": 42.394898,
"lng": 2.112117,
"image_url": "http:\/\/test.test.com\/image.png",
"user_distance": 0.03
},
"relationships": {
"place_address": {
"data": {
"type": "place_address",
"id": "6f781c99-c991-442f-ae14-9630ee475f41"
}
}
}
}],
"included": [{
"type": "place_address",
"id": "00d66be8-7315-4f75-9dc1-7dc737a055ef",
"attributes": {
"name": "Test Pharmacy Address",
"country_code": "ES",
"postal_code": "",
"city": "",
"region": "",
"postal_address_line_one": "",
"postal_address_line_two": "",
"phone_number_one": "",
"phone_number_two": ""
}
}, {
"type": "place_address",
"id": "6f781c99-c991-442f-ae14-9630ee475f41",
"attributes": {
"name": "address",
"country_code": "ES",
"postal_code": "",
"city": "",
"region": "",
"postal_address_line_one": "",
"postal_address_line_two": "",
"phone_number_one": "",
"phone_number_two": ""
}
}]
}And I have this resource:
@JsonApi(type = "place")
public class PlaceResponse extends Resource {
@Json(name = "name")
public String name;
@Json(name = "image")
public String imageUrl;
@Json(name = "lat")
public Double latitude;
@Json(name = "lng")
public Double longitude;
@Json(name = "user_distance")
public Double userDistance;
}When I'm trying to parse that JSON I got this exception: "com.squareup.moshi.JsonDataException: Unknown type of resource: place_address"
Why I'm getting this exception if I'm not parsing the relationship? Is mandatory to parse every field of the JSON? I hope not.
Thanks in advance.
Metadata
Metadata
Assignees
Labels
No labels