Specify data which should be serialized to JSON
976903
function jsonSerialize()
    {
        $result = [
            'keyboard' => $this->keyboard
        ];

        if ($this->selective !== null) {
            $result['selective'] = $this->selective;
        }

        return $result;
    }
688528
def data_json(self, pretty=False):
        """"""
        if pretty:
            return json.dumps(self.data, sort_keys=True, indent=4, separators=(',', ': '))
        else:
            return json.dumps(self.data)
894105
def serialize(self, obj, method='json', beautify=False, raise_exception=False):
        """"""

        return self.helper.string.serialization.serialize(
            obj=obj, method=method, beautify=beautify, raise_exception=raise_exception)
8733
def dump_json(obj):
    """"""
    return simplejson.dumps(obj, ignore_nan=True, default=json_util.default)
1184709
def serialize_to_json(self, response_data):
        

        indent = None
        if settings.DEBUG:
            indent = 4

        # Serialize to JSON with Django's encoder: Adds date/time, decimal,
        # and UUID support.
        return json.dumps(response_data, indent=indent, cls=DjangoJSONEncoder)
722212
def encode_json(self, serializable):
        
        return json.dumps(serializable.serialize(), cls=self.encoder)
764797
def _data_to_json(data):
        
        if type(data) not in [str, unicode]:
            data = json.dumps(data)
        return data
199157
def put_json(self, uri, data, **kwargs):
        
        encoded_data = json.dumps(data)
        kwargs.setdefault("headers", {}).update({
            "Content-Type": "application/json",  # tell server we are sending json
        })
        return self.put(uri, data=encoded_data, **kwargs)
230191
def save_to_json(self):
        """"""
        requestvalues = {
            'Dataset': self.dataset,
            'Header' : self._get_item_array(self.header),
            'Filter' : self._get_item_array(self.filter),
            'Stub' : self._get_item_array(self.stub),
            'Frequencies': self.frequencies
        }
        return json.dumps(requestvalues)
28854
def json_default(obj):
    
    if isinstance(obj, datetime):
        return obj.strftime("%Y-%m-%d %H:%M:%S")
    elif isinstance(obj, Decimal):
        return float(obj)
    elif isinstance(obj, uuid.UUID):
        return text_type(obj)
    else:
        try:
            return text_type(obj)
        except:
            pass

    raise TypeError("%r is not JSON serializable" % obj)
937656
def serialize(self):
        
        return {
            "uuid": self.uuid, "type": self.type, "instance_id": self.instance_id,
            "prepared": self.prepared, "creation_time": self.creation_time,
            "data": self.data
        }
1232437
def to_json(value, **kwargs):
        
        serial_dict = {
            key: (
                val.serialize(**kwargs) if isinstance(val, HasProperties)
                else val
            )
            for key, val in iteritems(value)
        }
        return serial_dict
749170
def json_serialize(obj):
    
    if isinstance(obj, datetime):
        return obj.isoformat()

    if hasattr(obj, 'id'):
        return jsonify(obj.id)

    if hasattr(obj, 'name'):
        return jsonify(obj.name)

    raise TypeError('{0} is not JSON serializable'.format(obj))
1019450
def serialize(self, data):
        

        super(Serializer, self).serialize(data)

        body = {
            'jsonapi': {
                'version': goldman.config.JSONAPI_VERSION,
            },
            'links': {
                'self': self.req.path,
            },
            'meta': {
                'included_count': 0,
                'primary_count': 0,
                'total_primary': self.req.pages.total,
            },
        }

        included = data['included']
        if included:
            body['included'] = self._serialize_datas(included)
            body['meta']['included_count'] = len(included)

        _data = data['data']
        if isinstance(_data, list):
            body.update({'data': self._serialize_datas(_data)})
            body.update({'links': self._serialize_pages()})
            body['meta']['primary_count'] = len(_data)
        elif _data:
            body.update({'data': self._serialize_data(_data)})
            body['meta']['primary_count'] = 1
        else:
            body.update({'data': None})

        self.resp.body = json.dumps(body)
925080
def json_data(self):
        
        def stringify_keys(d):
            if not isinstance(d, dict):
                return d
            return dict((str(k), stringify_keys(v)) for k, v in d.items())
        data = self.make_data()
        json_data = json.dumps(stringify_keys(data))
        return json_data
236213
def save_json(object, handle, indent=2):
    """"""
    obj_json = json.dumps(object, indent=indent, cls=NumpyJSONEncoder)
    handle.write(obj_json)
677383
def to_json(data, pretty):
    
    if pretty:
        return json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
    return json.dumps(data)