(data)
return json.dumps(data)
Returns an encoded string that can be stored in the database.

        Raises:
            ValueError: If the value is not a dict.
Returns an encoded string that can be stored in the database.
Returns an encoded string that can be stored in the database .
def encode(data):
        """Returns an encoded string that can be stored in the database.

        Raises:
            ValueError: If the value is not a dict.
        """
        if not isinstance(data, dict):
            raise ValueError('Data needs to be a dictionary.')

        return json.dumps(data)
def encode ( data ) : if not isinstance ( data , dict ) : raise ValueError ( 'Data needs to be a dictionary.' ) return json . dumps ( data )