Skip to content

Commit

Permalink
Fix: MISTags local field is jsonify as int
Browse files Browse the repository at this point in the history
In MISP, MISPTag's local field is jsonify as an int, however
PyMISP jsonify it as a string. This is unexpected.
  • Loading branch information
Sura De Silva committed Mar 6, 2024
1 parent a7446b3 commit ee5e7d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pymisp/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ 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'))

# 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:
Expand Down

0 comments on commit ee5e7d6

Please sign in to comment.