Skip to content

Commit

Permalink
update orjson opt to seralize numpy objs (#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyu-ms authored Jan 8, 2025
1 parent 4711784 commit 7562ae2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/newsfragments/3178_changed.orjson_opt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update ``orjson`` dumping option to allow serializing ``numpy`` objects.
3 changes: 2 additions & 1 deletion testplan/common/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def json_dumps(data, indent_2=False, default=None) -> str:
return orjson.dumps(
data,
default=default,
option=orjson.OPT_INDENT_2 if indent_2 else 0,
option=(orjson.OPT_INDENT_2 if indent_2 else 0)
| orjson.OPT_SERIALIZE_NUMPY,
).decode()
else:
if default:
Expand Down

0 comments on commit 7562ae2

Please sign in to comment.