VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
637 stars 178 forks source link

simplejson cannot convert matches to JSON in yara-python 4.3.0 #230

Closed seanthegeek closed 7 months ago

seanthegeek commented 1 year ago

My project yaramail uses simplejson to return details in JSON format, including YARA matches. This worked fine until yara-python 4.3.0. When yara-python 4.3.0 is used, simplejson raises a TypeError exception, with the error message "Object of type StringMatch is not JSON serializable"

wxsBSD commented 1 year ago

4.3.0 changed string matches to be an actual object with properties for the offset and length instead of a tuple. You can convert it into whatever you like, but accessing it as a tuple is no longer possible.