netzob.Common.Utils.Serialization package

Submodules

netzob.Common.Utils.Serialization.JSONSerializator module

class JSONSerializator[source]

Bases: object

static serialize(obj)[source]

Serialize the specified object under a specific JSON format. It inspects the specified object to search for attributes to serialize.

>>> from netzob.all import *
>>> msg = RawMessage("hello")
>>> print(JSONSerializator.serialize(msg))

It’s not possible to serialize a None object

>>> JSONSerializator.serialize(None)
Traceback (most recent call last):
...
TypeError: Cannot serialize a None object
Parameters:obj (object) – the object to serialize
Returns:the object serialized in JSON
Return type:str

Module contents