You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A likely solution would be to check for such objects in to_dict() of cybox.Entity and if found, cast them to a string before passing them into the dictionary. This is essentially what python-stix does in its to_dict() methods.
I don't know if we want to convert it to a string in to_dict or to_json. For DateTimeObjectPropertys, to_dict already returns a string (I don't know if that's ideal or not). If we want to leave it as a datetime in the dictionary representation, we can write a custom JSON Encoder for this, and use this in our to_json function.
Certain CybOX fields that use xs:dateTime as their base type will throw "not JSON serializable" errors when trying to serialize
python-cybox
objects parsed in from CybOX XML documents to JSON, due to their being marshaled into python datetime objects in the bindings. E.g., https://github.com/CybOXProject/python-cybox/blob/master/cybox/bindings/cybox_core.py#L915-921.A likely solution would be to check for such objects in
to_dict()
ofcybox.Entity
and if found, cast them to a string before passing them into the dictionary. This is essentially whatpython-stix
does in itsto_dict()
methods.This can be replicated via:
This is related to: MAECProject/python-maec#66 and MAECProject/python-maec@0d844b6
The text was updated successfully, but these errors were encountered: