Is there a way to accept POSTed json with hyphens in property names #8118
Unanswered
brianbakeratx
asked this question in
Questions
Replies: 3 comments
-
Yes, you can set the field alias to include a hyphen. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yep, as @dmontagu says 👆. Here are the docs: https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#alias-parameters And here for Pydantic: https://pydantic-docs.helpmanual.io/usage/schema/#field-customisation Have in mind that FastAPI still doesn't support version 1 of Pydantic (but soon). So, you have to use |
Beta Was this translation helpful? Give feedback.
0 replies
-
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on my first project with fastapi. Our service is receiving webhook POSTs from Nexom. Nexom's json vocabulary using hyphens in some property names, e.g. "message-timestamp".
Is it possible to unmarshal a json document that contains hypens in property names into a pydantic BaseModel? If not, is there another way to unmarshal the json request body into a dict or some other type?
Beta Was this translation helpful? Give feedback.
All reactions