Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docarray/base_doc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ def json(
# we need to do this because pydantic will not recognize DocList correctly
original_exclude = original_exclude or {}
if field not in original_exclude:
val = getattr(self, field)
data[field] = [doc.dict() for doc in val] if val is not None else None
data[field] = getattr(
self, field
) # here we need to keep doclist as doclist otherwise if a user want to have a special json config it will not work

# this is copy from pydantic code
if self.__custom_root_type__:
Expand Down