Skip to content

Commit 8c3ad41

Browse files
committed
Formatting
1 parent c4dcdb1 commit 8c3ad41

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ car = Car({
4242
print(car) # Car(make='Ford', model='Focus', manufactured_at=datetime.date(2018, 3, 14), num_of_wheels=4)
4343
```
4444

45-
Class field types can be any primitive type (eg. `str`, `int`, `datetime`), a variadic generic (eg. `list[str]`, `Optional[int]`, `Literal["hello", "world"]`). The `default_value` argument of `jsonfield` will be used if the key is not found in the json structure, the type of the class field is not `Optional[...]`. In this case, the value of `default_value` will be passed to the supplied parser function.
45+
Class field types can be any primitive type (eg. `str`, `int`, `datetime`),
46+
a variadic generic (eg. `list[str]`, `Optional[int]`, `Literal["hello", "world"]`),
47+
or even another jsondataclass. The `default_value` argument of `jsonfield` will be used
48+
if the specified key is not found in the dictionary *and* the type of the class field is not `Optional[...]`.
49+
In this case, the value of `default_value` will be passed to the supplied parser function.

0 commit comments

Comments
 (0)