Repository: django-json-api/django-rest-framework-json-api

Issue:
JSON output incorrectly wrapping id in quotes
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

```


Discussion:
"Every resource object MUST contain an id member and a type member. The values of the id and type members MUST be strings."

Reference: https://jsonapi.org/format/#document-resource-object-identification
As additional hinter there is for instance [following project](https://github.com/adfinis-sygroup/timed-frontend) which uses DJA in the newest version with ember and it works without any problems.

Maybe you can find some hinters there to solve your issue. 
Thanks for the quick response and the links for clarity.
I've now refactored my backend and everything now works correctly.
It might be worth updating the README.rst as the opening example shows the `identity` JSON-API response with unquoted IDs. This is partly what sent me down this rabbit-hole.
Keep up the great work 👍👍
A documentation improvement PR would be gladly accepted!

On Thu, Aug 27, 2020 at 5:22 PM Andy Taylor <notifications@github.com>
wrote:

>
>
>
> Thanks for the quick response and the links for clarity.
>
>
>
> I've now refactored my backend and everything now works correctly.
>
>
>
> It might be worth updating the README.rst as the opening example shows the
> identity JSON-API response with unquoted IDs. This is partly what sent me
> down this rabbit-hole.
>
>
>
> Keep up the great work 👍👍
>
>
>
>
>
>
> —
> You are receiving this because you modified the open/close state.
>
>
> Reply to this email directly, view it on GitHub
> <https://github.com/django-json-api/django-rest-framework-json-api/issues/818#issuecomment-682197922>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABBHS52T6XTMLENIPAAX573SC3FBDANCNFSM4QLGQC2A>
> .
>
>
>
>


Resolving patch:
diff --git a/rest_framework_json_api/renderers.py b/rest_framework_json_api/renderers.py
--- a/rest_framework_json_api/renderers.py
+++ b/rest_framework_json_api/renderers.py
@@ -33,7 +33,7 @@ class JSONRenderer(renderers.JSONRenderer):
           "data": [
             {
               "type": "companies",
-              "id": 1,
+              "id": "1",
               "attributes": {
                 "name": "Mozilla",
                 "slug": "mozilla",


Test patch: