Skip to content

Problem with parsing empty Relationship array #89

@mkonkel

Description

@mkonkel

java.lang.RuntimeException: java.lang.Exception: com.squareup.moshi.JsonDataException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $.data[0].relationships

Retrofit call:

    @GET("someApi/someModel")
    fun getSomeModel(): Single<ArrayDocument<SomeModel>>

Model:

@JsonApi(type = "some_model")
public class SomeModel extends Resource {
    @Json(name = "foo")
    public String foo;
    @Json(name = "bar")
    public String bar;
}

Response:

{
	"data": [{
		"type": "some_model",
		"id": 1,
		"attributes": {
			"foo": "text text",
			"bar": "text text"
		},
		"relationships": [],
		"links": []
	}]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions