Updating bodySerializer
Documentation to handle nested objects correctly
#1674
lemonadern
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current
bodySerializer
documentation provides the following code example:However, this code fails to serialize nested objects (in this case,
{version: 2}
) as FormData. Consequently, when executed, the data received by the API server appears as follows:To address this, I propose several suggestions for revising the documentation:
Suggestions
1. remove nested object:
Resulting API server data:
2. serialize nested object using
JSON.stringify
:Resulting API server data:
3. Flatten nested objects using dot notation concatenation:
Resulting API server data:
4. A generalized version of No.2 (
JSON.stringify
):Resulting API server data:
5. A generalized version of No.3 (dot notaion):
Resulting API server data:
What do you think of these suggestions?
Beta Was this translation helpful? Give feedback.
All reactions