Call json.dumps with the attributes of this instance as
        arguments.
552200
def dumps(self, blob):
        

        return json.dumps(
            blob, indent=self.indent, sort_keys=True,
            separators=self.separators,
        )
142598
def dict_jsonify(param):
    """"""
    if not isinstance(param, dict):
        param = dict(param)
    return jsonify(param)
1076738
def _write_json(filepath, data, kwargs):
    """"""
    with io_stl.open(filepath, 'w', encoding='utf8') as outfile:
        if 'indent' not in kwargs:
            kwargs['indent'] = 4
        if 'sort_keys' not in kwargs:
            kwargs['sort_keys'] = True
        if 'separators' not in kwargs:
            kwargs['separators'] = (',', ': ')
        if 'ensure_ascii' not in kwargs:
            kwargs['ensure_ascii'] = False
        str_ = json.dumps(data, **kwargs)
        outfile.write(to_unicode(str_))
    return data
472678
def write_json(self, **kwargs):
        
        self.stdout.write(json.dumps(kwargs) + "\n")
        self.stdout.flush()
924189
def toJson(self, data=None, pretty=False):
        """"""
        if data==None: data = self.attrs
        data = self.flatten(data) # don't send objects as str in json
        #if pretty:
        ret = json.dumps(data, indent=4, sort_keys=True)
        #self.inflate() # restore objects from json str data
        return ret
482305
def json_dumps(o):
    """"""
    return json.dumps(o, indent=4, sort_keys=True, ensure_ascii=True,
                      separators=(',', ': ')).encode('ascii')
1250479
def dump(self):
        """"""
        metadata = dict()
        for attr in sorted(self.datastore):
            # Initialise the attribute (e.g. sample.general) key in the metadata dictionary
            metadata[attr] = dict()
            # Ignore attributes that begin with '__'
            if not attr.startswith('__'):
                # If self.datastore[attribute] is a primitive datatype, populate the metadata dictionary with
                # the attr: self.datastore[attr] pair
                # e.g. attr: name,  self.datastore[attr]: 2013-SEQ-0072
                if isinstance(self.datastore[attr], str) or \
                        isinstance(self.datastore[attr], list) or \
                        isinstance(self.datastore[attr], dict) or \
                        isinstance(self.datastore[attr], int):
                    metadata[attr] = self.datastore[attr]
                else:
                    # Otherwise, recursively convert GenObjects to nested dictionaries
                    metadata.update(self.nested_genobject(metadata, attr, self.datastore))
        return metadata
489024
def write_json(data, filename):
    

    def custom_default(obj):
        if obj is None or (hasattr(obj, 'isNull') and obj.isNull()):
            return ''
        raise TypeError

    with open(filename, 'w') as json_file:
        json.dump(data, json_file, indent=2, default=custom_default)
480395
def dumps(self):
        """"""
        return {table_name: getattr(self, table_name).dumps() for table_name in self.TABLES}
512765
def publish_json(self, channel, obj):
        """"""
        return self.publish(channel, json.dumps(obj))
388169
def _encode_json(obj):
    '''
    
    '''
    def _dump_obj(obj):
        if isinstance(obj, dict):
            return obj
        d = dict()
        for k in dir(obj):
            if not k.startswith('_'):
                d[k] = getattr(obj, k)
        return d
    return json.dumps(obj, default=_dump_obj)
735407
def to_output(self, value):
        """"""
        return json.loads(resolwe_runtime_utils.save_file(self.name, value.path, *value.refs))
100474
def dump_json(json_info, json_file, overwrite=True):
    
    if overwrite:
        mode = "w"
    else:
        mode = "w+"

    try:
        with open(json_file, mode) as f:
            f.write(json.dumps(json_info))
    except BaseException as e:
        logging.error(e.message)
249364
def dumps(data, **kwargs):
    """"""

    def _encoder(value):
        if isinstance(value, datetime.datetime):
            return value.isoformat()

        if hasattr(value, "_data"):
            return value._data

        raise TypeError('Could not encode %r' % value)

    return json.dumps(data, default=_encoder, **kwargs)
420378
def dump(self, ret):
        
        if self.args.flatten:
            ret = drop_none(flatten(ret))

        logger.info('Dump: \n' + json.dumps(ret, cls=AutoJSONEncoder, indent=2 if self.args.indent else None))
84624
def dump(obj, fp, **kwargs):
    """"""

    s = dumps(obj, **kwargs)
    fp.write(str(s))
704512
def dump(obj, path, **kw):
    
    open_kw = {'mode': 'w'}
    if PY3:  # pragma: no cover
        open_kw['encoding'] = 'utf-8'

    # avoid indented lines ending with ", " on PY2
    if kw.get('indent') and kw.get('separators') is None:
        kw['separators'] = (',', ': ')

    with open(str(path), **open_kw) as fp:
        return json.dump(obj, fp, **kw)