Skip to content
New issue

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

JsonDataException parsing a null attribute #43

Closed
antonicg opened this issue Jan 16, 2017 · 1 comment
Closed

JsonDataException parsing a null attribute #43

antonicg opened this issue Jan 16, 2017 · 1 comment

Comments

@antonicg
Copy link

If you are receiving from Retrofit request as response an included object with a relation that has a null attribute and you declared it as String is giving:
com.squareup.moshi.JsonDataException: Expected a name but was NULL at path $.attributes.logo_url

The response:

"links": {
    "self": "someurl/params"
  },
  "data": [
    {
      "type": "some_type",
      "id": "12345",
      "attributes": {
        "attr1": 1,
        "attr2": 2,
        "attr3": 3
      },
      "relationships": {
        "some_objects": {
          "data": [
            {
              "type": "some_objects",
              "id": "1"
            },
            {
              "type": "some_objects",
              "id": "2"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "type": "some_objects",
      "id": "1",
      "attributes": {
        "id": "1",
        "parentId": "1"
      },
      "relationships": {
        "subobjects": {
          "data": [
            {
              "type": "subobjects",
              "id": "2"
            }
          ]
        }
    }
    {
      "type": "subobjects",
      "id": "2",
      "attributes": {
        "name":"a name",
       "logo_url":null
      }
    }
  ],
  "meta": {
    "total": 1,
    "totalCount": 1,
    "correction": []
  }
}
@kamikat
Copy link
Owner

kamikat commented Jan 18, 2017

It's fixed in version 3.0.5. Thanks for your help 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants