Skip to content

JSON output incorrectly wrapping id in quotes #818

Closed
@GrandSlam90

Description

@GrandSlam90

I've dropped DRF-JSON-API into my DRF application following all the defaults but I'm getting strange output where the model's id is being wrapped in quotations. This is causing issues with my Ember.js frontend as it's unable to properly parse the output.
I've checked the database and the id field is defined as an integer. Every other field seems to be serialized correctly.
What setting am I missing?!

Sample output:

{
  "links": {
    "first": "http://localhost:8000/dat/?page%5Bnumber%5D=1",
    "last": "http://localhost:8000/dat/?page%5Bnumber%5D=1",
    "next": null,
    "prev": null
  },
  "data": [
    {
      "type": "Dat",
      "id": "1",
      "attributes": {
        "name": "Nintendo - Nintendo Switch",
        "description": "Nintendo - Nintendo Switch",
        "matched_games": 0,
        "missing_games": 618,
        "last_verified": "2020-08-05T16:43:27.041339Z"
      }
    }
  ],
  "meta": {
    "pagination": {
      "page": 1,
      "pages": 1,
      "count": 1
    }
  }
}

Response code: 200 (OK); Time: 55ms; Content length: 410 bytes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions