Created
April 24, 2021 18:23
-
-
Save Kos/5174f44573a39560c41e750dd5bfb0b1 to your computer and use it in GitHub Desktop.
This file contains 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
def book_to_json(book: Book): | |
return { | |
"isbn": book.isbn, | |
"title": book.title, | |
"author": book.author, | |
} | |
def book_from_json(data: dict) -> Book: | |
return Book( | |
isbn=data["isbn"], | |
title=data["title"], | |
author=data["author"], | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment