Export the whole roster as currently stored on the client side into a
        JSON-compatible dictionary and return that dictionary.
505043
def export_as_json(self):
        
        return {
            "items": {
                str(jid): item.export_as_json()
                for jid, item in self.items.items()
            },
            "ver": self.version
        }
298361
def export_to_dicts(table, *args, **kwargs):
    """"""
    field_names = table.field_names
    return [{key: getattr(row, key) for key in field_names} for row in table]
784958
def export_data(self):
        
        result = {}
        data = self.__original_data__.copy()
        data.update(self.__modified_data__)
        for key, value in data.items():
            if key in self.__deleted_fields__:
                continue

            try:
                result[key] = value.export_data()
            except AttributeError:
                result[key] = value

        return result
405620
def to_json(self):
        

        result = {}
        for k, v in self._data.items():
            result[camel_case(k)] = v
        return result
1101736
def get_data(self, minion):
        '''
        
        '''
        ret = copy.deepcopy(__opts__.get('roster_defaults', {}))
        if isinstance(self.raw[minion], six.string_types):
            ret.update({'host': self.raw[minion]})
            return ret
        elif isinstance(self.raw[minion], dict):
            ret.update(self.raw[minion])
            return ret
        return False
9930
def export_for_schema(self):
        
        if self.options_map:
            return dict((str(key), str(value)) for key, value in self.options_map.items())
        return "{'class': '%s'}" % (self.name, )
351188
def exportJsonFile(self, fileName):
        

        # Because our Profile class is not directly JSON serializable, we exporrt the underlying 
        # dictionary. 
        data = dict()
        for key in self.__dict__.keys():
            if key != "preferences":
                data[key] = self.__dict__[key]
        
        # The Preference class is also not directly JSON serializable, so we export the underlying
        # dictionary for each Preference object.
        preferenceDicts = []
        for preference in self.preferences:
            preferenceDict = dict()
            for key in preference.__dict__.keys():
                preferenceDict[key] = preference.__dict__[key]
            preferenceDicts.append(preferenceDict)
        data["preferences"] = preferenceDicts

        outfile = open(fileName, 'w')
        json.dump(data, outfile)
        outfile.close()
1281822
def dump(self):
        """"""

        return {
            'title': self.title,
            'issue_id': self.issue_id,
            'reporter': self.reporter,
            'assignee': self.assignee,
            'status': self.status,
            'product': self.product,
            'component': self.component,
            'created_at': self.created_at,
            'updated_at': self.updated_at,
            'closed_at': self.closed_at,
            'status_code': self.status_code
        }
517147
def json(self):
        """"""
        d = { 'id': self.id, 'format': self.formatclass.__name__,'label': self.label, 'mimetype': self.formatclass.mimetype,  'schema': self.formatclass.schema }
        if self.unique:
            d['unique'] = True
        if self.filename:
            d['filename'] = self.filename
        if self.extension:
            d['extension'] = self.extension
        if self.acceptarchive:
            d['acceptarchive'] = self.acceptarchive
        #d['parameters'] = {}

        #The actual parameters are included as XML, and transformed by clam.js using XSLT (parameter.xsl) to generate the forms
        parametersxml = ''
        for parameter in self.parameters:
            parametersxml += parameter.xml()
        d['parametersxml'] = '<?xml version="1.0" encoding="utf-8" ?><parameters>' + parametersxml + '</parameters>'
        d['converters'] = [ {'id':x.id, 'label':x.label} for x in self.converters ]
        d['inputsources'] = [ {'id':x.id, 'label':x.label} for x in self.inputsources ]

        return json.dumps(d)
522561
def ToJson(self):
        
        jsn = super(PublishTransaction, self).ToJson()
        jsn['contract'] = {}
        jsn['contract']['code'] = self.Code.ToJson()
        jsn['contract']['needstorage'] = self.NeedStorage
        jsn['contract']['name'] = self.Name.decode('utf-8')
        jsn['contract']['version'] = self.CodeVersion.decode('utf-8')
        jsn['contract']['author'] = self.Author.decode('utf-8')
        jsn['contract']['email'] = self.Email.decode('utf-8')
        jsn['contract']['description'] = self.Description.decode('utf-8')
        return jsn
530976
def userToJson(user):
    
    obj = {
        'id': user.id,
        'username': user.username,
        'name': user.get_full_name(),
        'email': user.email,
    }

    return obj
138889
def to_json(self, pretty=True):
        
        data_dict = self.to_dict()
        if pretty:
            return json.dumps(
                data_dict, sort_keys=True, indent=2)
        return json.dumps(data_dict, sort_keys=True)
158774
def to_dict(self, serialize=False):
        
        if serialize:
            encode_method = json_encode_for_zendesk
        else:
            encode_method = json_encode_for_printing
        return json.loads(json.dumps(self._to_dict(serialize=serialize), default=encode_method))
1043900
def pages_to_json(queryset):
    
    # selection may be in the wrong order, and order matters
    queryset = queryset.order_by('tree_id', 'lft')
    return simplejson.dumps(
        {JSON_PAGE_EXPORT_NAME: JSON_PAGE_EXPORT_VERSION,
            'pages': [page.dump_json_data() for page in queryset]},
        indent=JSON_PAGE_EXPORT_INDENT, sort_keys=True)
855728
def to_json(self):
    
    if self._key_ranges is None:
      key_ranges_json = None
    else:
      key_ranges_json = []
      for k in self._key_ranges:
        if k:
          key_ranges_json.append(k.to_json())
        else:
          key_ranges_json.append(None)

    if self._ns_range is None:
      namespace_range_json = None
    else:
      namespace_range_json = self._ns_range.to_json_object()

    if self._current_key_range is None:
      current_key_range_json = None
    else:
      current_key_range_json = self._current_key_range.to_json()

    json_dict = {self.KEY_RANGE_PARAM: key_ranges_json,
                 self.NAMESPACE_RANGE_PARAM: namespace_range_json,
                 self.CURRENT_KEY_RANGE_PARAM: current_key_range_json,
                 self.ENTITY_KIND_PARAM: self._entity_kind,
                 self.BATCH_SIZE_PARAM: self._batch_size,
                 self.FILTERS_PARAM: self._filters}
    return json_dict
365323
def export(self, private_keys=True):
        
        exp_dict = dict()
        for k, v in iteritems(self):
            if k == 'keys':
                keys = list()
                for jwk in v:
                    keys.append(json_decode(jwk.export(private_keys)))
                v = keys
            exp_dict[k] = v
        return json_encode(exp_dict)
92514
def to_json(self, indent=None):
        """"""

        inputs = ParameterCollection(self.inputs)

        d = {
            'meta': {
                'name': self.name,
                'description': self.description
            },
            'inputs': [],
            'workflow': [],
            'outputs': [{'name': k, 'node': v} for k, v in six.iteritems(self.output_mapping)]
        }

        for parameter in self.inputs:
            input_info = {
                'name': parameter.name,
                'type': parameter.id
            }

            args, kwargs = parameter.serialize_args()
            args = list(args)
            args.pop(0)  # 'name' is already taken care of
            kwargs.pop('required', None)  # 'required' is assumed True for workflow inputs
            if args or kwargs:
                input_info['args'] = [args, kwargs]

            d['inputs'].append(input_info)

        for node in sorted(six.itervalues(self.nodes_by_id), key=lambda x: x.id):
            task_name = node.task.name
            if not task_name:
                raise ValueError('The task {0} does not have a name and therefore cannot be serialized.'.format(
                    node.task.__class__.__name__)
                )

            node_inputs = {}
            for input_name, (source, value) in six.iteritems(node.inputs):
                input_info = {'source': source}

                if source == 'input':
                    input_info['input'] = inputs.by_name[value].name
                else:
                    input_info['node'] = value

                node_inputs[input_name] = input_info

            d['workflow'].append({
                'id': node.id,
                'task': task_name,
                'inputs': node_inputs
            })

        return json.dumps(d, indent=indent)