Created
September 8, 2021 14:06
-
-
Save ciscoinfo/3bf9cccb7d5b9b66ffe8d3df7d7c5847 to your computer and use it in GitHub Desktop.
article Flask (Python) : lire une requête PUT / POST - marsh 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # serialize one instance with Marshmallow | |
| product = Product(name="jambon", price=5, description="Le meilleur jambon") | |
| serialized_product = product_schema.dump(product) | |
| # serialize many instances with Marshmallow | |
| serialized_products = products_schema.dump(products) | |
| # deserialize a dict to an object (instance) with Marshmallow | |
| product_dict_1 = {"name": "jambon", "price": 12.5, "description": "La meilleure pizza made in Italie"} | |
| new_instance = product_schema.load(product_dict_1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment