def _json_serial()

in app/marketplace.py [0:0]


    def _json_serial(obj):
        if isinstance(obj, Decimal):
            return int(obj)
        if isinstance(obj, set):
            return list(obj)
        if isinstance(obj, Dimension):
            return {
                "name": obj.name,
                "quantity": obj.quantity,
                "timestamp": obj.timestamp,
                "datetime": obj.datetime
            }
        if isinstance(obj, State):
            return {
                "value": obj.value(),
                "details": list(obj.details),
                "type": obj.type
            }
        raise TypeError("Type %s not serializable" % type(obj))