Skip to content

How come FORMAT_FIELD_NAMES isn't recursive on dictionaries? #1057

Answered by sliverc
jimbofreedman asked this question in Q&A
Discussion options

You must be logged in to vote

You can find a detailed explanation in PR #420. In short only the field name is part of the JSON:API specification but the value (a value might be nested json) should remain untouched.

For me an option JSON_API_FORMAT_FIELD_NAMES_RECURSIVE does not make sense in the context of DJA as the value is not specified how it needs to be formatted and therefore needs to be kept untouched by the DJA framework.

What you can do is though to overwrite to_internal_value and to_representation either of a nested serializer, a DictField or JSONField. where you then call utils.format_field_names recursively.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jimbofreedman
Comment options

Answer selected by sliverc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants