Skip to content

Instantly share code, notes, and snippets.

@ciscoinfo
Created September 8, 2021 14:06
Show Gist options
  • Select an option

  • Save ciscoinfo/3bf9cccb7d5b9b66ffe8d3df7d7c5847 to your computer and use it in GitHub Desktop.

Select an option

Save ciscoinfo/3bf9cccb7d5b9b66ffe8d3df7d7c5847 to your computer and use it in GitHub Desktop.
article Flask (Python) : lire une requête PUT / POST - marsh 1
# 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