Skip to content

Commit f5b5c21

Browse files
committed
mention that the scheduler is also json-serializable
1 parent 59b0e46 commit f5b5c21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ card, review_log = scheduler.review_card(card=card, rating=Rating.Good, review_d
101101

102102
### Serialization
103103

104-
`Card` and `ReviewLog` objects are json-serializable via their `to_dict` and `from_dict` methods for easy database storage:
104+
`AnkiSM2Scheduler`, `Card` and `ReviewLog` objects are all json-serializable via their `to_dict` and `from_dict` methods for easy database storage:
105105
```python
106106
# serialize before storage
107+
scheduler_dict = scheduler.to_dict()
107108
card_dict = card.to_dict()
108109
review_log_dict = review_log.to_dict()
109110

110111
# deserialize from dict
112+
scheduler = AnkiSM2Scheduler.from_dict(scheduler_dict)
111113
card = Card.from_dict(card_dict)
112114
review_log = ReviewLog.from_dict(review_log_dict)
113115
```

0 commit comments

Comments
 (0)