rest_framework_json_api.parsers module¶
Parsers
-
class
rest_framework_json_api.parsers.
JSONParser
¶ Bases:
rest_framework.parsers.JSONParser
Similar to JSONRenderer, the JSONParser you may override the following methods if you need highly custom parsing control.
A JSON API client will send a payload that looks like this:
{ "data": { "type": "identities", "id": 1, "attributes": { "first_name": "John", "last_name": "Coltrane" } } }
We extract the attributes so that DRF serializers can work as normal.
-
media_type
= 'application/vnd.api+json'¶
-
renderer_class
¶
-
static
parse_attributes
(data)¶
-
static
parse_relationships
(data)¶
-
static
parse_metadata
(result)¶ Returns a dictionary which will be merged into parsed data of the request. By default, it reads the meta content in the request body and returns it in a dictionary with a _meta top level key.
-
parse
(stream, media_type=None, parser_context=None)¶ Parses the incoming bytestream as JSON and returns the resulting data
-