il2_rest/models.py
def to_json(cls, obj, hide_null=True, return_as_str=False) :
        """
        Convert an object to a dict (JSON like).

        Args:
            obj (:obj:`list`/:obj:`dict`/:obj:`BaseModel`): Object to be converted to JSON.
            hide_null (:obj:`bool`, optional): If True, discards every item (key, value) where value is None.
            return_as_str (:obj:`bool`, optional): If True, return the JSON as a string instead of a dict.

        Returns:
            :obj:`dict`/:obj:`str` : return obj as a JSON
        """   
        ret_json = json.loads(json.dumps(obj, cls=CustomEncoder))
        
        if hide_null :
            ret_json = filter_none(ret_json)
        
        if isinstance(ret_json,dict) and 'JSON' in ret_json.keys() :
            ret_json['json'] = ret_json['JSON']
            del ret_json['JSON']

        if return_as_str :
            return json.dumps(ret_json)
        else :
            return ret_json

        Convert an object to a dict (JSON like).

        Args:
            obj (:obj:`list`/:obj:`dict`/:obj:`BaseModel`): Object to be converted to JSON.
            hide_null (:obj:`bool`, optional): If True, discards every item (key, value) where value is None.
            return_as_str (:obj:`bool`, optional): If True, return the JSON as a string instead of a dict.

        Returns:
            :obj:`dict`/:obj:`str` : return obj as a JSON
        
Convert an object to a dict (JSON like).
Convert an object to a dict ( JSON like ) .
def to_json(cls, obj, hide_null=True, return_as_str=False) :
        ret_json = json.loads(json.dumps(obj, cls=CustomEncoder))
        if hide_null :
            ret_json = filter_none(ret_json)
        if isinstance(ret_json,dict) and 'JSON' in ret_json.keys() :
            ret_json['json'] = ret_json['JSON']
            del ret_json['JSON']
        if return_as_str :
            return json.dumps(ret_json)
        else :
            return ret_json
def to_json ( cls , obj , hide_null = True , return_as_str = False ) : ret_json = json . loads ( json . dumps ( obj , cls = CustomEncoder ) ) if hide_null : ret_json = filter_none ( ret_json ) if isinstance ( ret_json , dict ) and 'JSON' in ret_json . keys ( ) : ret_json [ 'json' ] = ret_json [ 'JSON' ] del ret_json [ 'JSON' ] if return_as_str : return json . dumps ( ret_json ) else : return ret_json
Convert an object to a dict (JSON like).
Convert an object to a dict ( JSON like ) .
"""
        Convert an object to a dict (JSON like).

        Args:
            obj (:obj:`list`/:obj:`dict`/:obj:`BaseModel`): Object to be converted to JSON.
            hide_null (:obj:`bool`, optional): If True, discards every item (key, value) where value is None.
            return_as_str (:obj:`bool`, optional): If True, return the JSON as a string instead of a dict.

        Returns:
            :obj:`dict`/:obj:`str` : return obj as a JSON
        """
None
cls
obj
hide_null
return_as_str
obj (
`list`/:obj:`dict`/:obj:`BaseModel`): Object to be converted to JSON.
` list ` / : obj : ` dict ` / : obj : ` BaseModel ` ) : Object to be converted to JSON .
hide_null (
`bool`, optional): If True, discards every item (key, value) where value is None.
` bool ` optional ) : If True discards every item ( key value ) where value is None .
return_as_str (
`bool`, optional): If True, return the JSON as a string instead of a dict.
` bool ` optional ) : If True return the JSON as a string instead of a dict .