Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: PyMISP must jsonify MISPTag's local field as an int #1171

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion pymisp/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,11 @@ def __repr__(self) -> str:
return '<{self.__class__.__name__}(name={self.name})>'.format(self=self)
return f'<{self.__class__.__name__}(NotInitialized)>'


def to_dict(self, json_format: bool = False) -> dict[str, Any]:
to_return = super().to_dict(json_format)
if to_return.get('local'):
to_return['local'] = int(to_return.get('local'))
return to_return
# UUID, datetime, date and Enum is serialized by ORJSON by default
def pymisp_json_default(obj: AbstractMISP | datetime | date | Enum | UUID) -> dict[str, Any] | str:
if isinstance(obj, AbstractMISP):
Expand Down
Loading