We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
The text was updated successfully, but these errors were encountered:
Hey @di0n0s I think this is a duplicate of #71
I ran in to the same problem and found yours and the above issue. Basically, the answer is to do as described here: https://github.com/kamikat/moshi-jsonapi#default-resource-type
Sorry, something went wrong.
No branches or pull requests
Hi,
I receive this JSON:
And I have this resource:
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.
The text was updated successfully, but these errors were encountered: