transform ariane_clip3 OS Type object to Ariane server JSON obj
        :return: Ariane JSON obj
511519
def ostype_2_json(self):
        
        LOGGER.debug("OSType.ostype_2_json")
        json_obj = {
            'osTypeID': self.id,
            'osTypeName': self.name,
            'osTypeArchitecture': self.architecture,
            'osTypeCompanyID': self.company_id,
            'osTypeOSInstancesID': self.osi_ids
        }
        return json.dumps(json_obj)
1064573
def to_json(self, is_admin=False):
        
        if is_admin:
            return {
                'accountId': self.account_id,
                'accountName': self.account_name,
                'accountType': self.account_type,
                'contacts': self.contacts,
                'enabled': True if self.enabled == 1 else False,
                'requiredRoles': self.required_roles,
                'properties': {to_camelcase(prop.name): prop.value for prop in self.account.properties}
            }
        else:
            return {
                'accountId': self.account_id,
                'accountName': self.account_name,
                'contacts': self.contacts
            }
642514
def _to_json_default(obj):
    
    # Datetime
    if isinstance(obj, datetime.datetime):
        return obj.isoformat()

    # UUID
    if isinstance(obj, uuid.UUID):
        return str(obj)

    # numpy
    if hasattr(obj, 'item'):
        return obj.item()

    # # Enum
    # if hasattr(obj, 'value'):
    #     return obj.value

    try:
        return obj.id
    except Exception:
        raise TypeError('{obj} is not JSON serializable'.format(obj=repr(obj)))
1152995
def namespace_to_dict(obj):
    
    if isinstance(obj, (argparse.Namespace, optparse.Values)):
        return vars(obj)
    return obj
776339
def to_json(self):
        

        result = super(Environment, self).to_json()
        result.update({
            'name': self.name
        })

        return result
1129747
def to_json_object(self):
    """"""
    obj_dict = dict(namespace_start=self.namespace_start,
                    namespace_end=self.namespace_end)
    if self.app is not None:
      obj_dict['app'] = self.app
    return obj_dict
1118554
def dump(obj, fp, **user_kwargs):
    
    return json.dump(obj, fp, **_encoder_kwargs(user_kwargs))
673451
def to_JSON(self):
        
        return json.dumps({"reference_time": self._reference_time,
                           "location": json.loads(self._location.to_JSON()),
                           "interval": self._interval,
                           "co_samples": self._co_samples,
                           "reception_time": self._reception_time,
                           })
132692
def to_json(self):
        
        data = dict(self.__dict__)
        data.pop('context',None)
        data['oauth'] = self.oauth.to_dict()
        data['cache'] = self.cache.to_dict()
        return json.dumps(data)
594222
def to_json(self):
        

        result = super(ApiKey, self).to_json()
        result.update({
            'name': self.name,
            'description': self.description,
            'accessToken': self.access_token,
            'environments': [e.to_json() for e in self.environments]
        })
        return result
213362
def export_to_json(self):
        

        return {
            hostname: sorted(self._encode_key(key) for key in pins)
            for hostname, pins in self._storage.items()
        }
1125816
def to_json_format(conf):
    ''''''
    if 'fmode' in conf:
        conf['fmode'] = oct(conf['fmode'])[-3:]
    if 'dmode' in conf:
        conf['dmode'] = oct(conf['dmode'])[-3:]
434460
def to_json(self):
        
        endpoints = []
        for endpoint in self.endpoints:
            list_fields = endpoint.fields
            resource_type = endpoint.Meta.resource_type
            table = endpoint.Meta.table

            data = endpoint.to_dict()
            data['fields'] = resource_type.get_type_of_fields(
                list_fields,
                table,
            )
            endpoints.append(data)

        data = {
            'title': self.title,
            'endpoints': sorted(endpoints, key=lambda x: x['name']),
        }

        return json.dumps(data)
185568
def _object_to_json_dict(obj: Any) -> Union[bool, int, float, str, Dict[str, Any]]:
    
    if isinstance(obj, Enum):
        # Properly serialize Enums (such as OpenSslVersionEnum)
        result = obj.name

    elif isinstance(obj, ObjectIdentifier):
        # Use dotted string representation for OIDs
        result = obj.dotted_string

    elif isinstance(obj, x509._Certificate):
        # Properly serialize certificates
        certificate = obj
        result = {  # type: ignore
            # Add general info
            'as_pem': obj.public_bytes(Encoding.PEM).decode('ascii'),
            'hpkp_pin': CertificateUtils.get_hpkp_pin(obj),

            # Add some of the fields of the cert
            'subject': CertificateUtils.get_name_as_text(certificate.subject),
            'issuer': CertificateUtils.get_name_as_text(certificate.issuer),
            'serialNumber': str(certificate.serial_number),
            'notBefore': certificate.not_valid_before.strftime("%Y-%m-%d %H:%M:%S"),
            'notAfter': certificate.not_valid_after.strftime("%Y-%m-%d %H:%M:%S"),
            'signatureAlgorithm': certificate.signature_hash_algorithm.name,
            'publicKey': {
                'algorithm': CertificateUtils.get_public_key_type(certificate)
            },
        }

        dns_alt_names = CertificateUtils.get_dns_subject_alternative_names(certificate)
        if dns_alt_names:
            result['subjectAlternativeName'] = {'DNS': dns_alt_names}  # type: ignore

        # Add some info about the public key
        public_key = certificate.public_key()
        if isinstance(public_key, EllipticCurvePublicKey):
            result['publicKey']['size'] = str(public_key.curve.key_size)  # type: ignore
            result['publicKey']['curve'] = public_key.curve.name  # type: ignore
        else:
            result['publicKey']['size'] = str(public_key.key_size)
            result['publicKey']['exponent'] = str(public_key.public_numbers().e)

    elif isinstance(obj, object):
        # Some objects (like str) don't have a __dict__
        if hasattr(obj, '__dict__'):
            result = {}
            for key, value in obj.__dict__.items():
                # Remove private attributes
                if key.startswith('_'):
                    continue

                result[key] = _object_to_json_dict(value)
        else:
            # Simple object like a bool
            result = obj

    else:
        raise TypeError('Unknown type: {}'.format(repr(obj)))

    return result
570669
def to_JSON(self):
        
        return json.dumps({'id': self.id,
                           'external_id': self.external_id,
                           'name': self.name,
                           'created_at': timeformatutils.to_ISO8601(self.created_at),
                           'updated_at': timeformatutils.to_ISO8601(self.updated_at),
                           'lat': self.lat,
                           'lon': self.lon,
                           'alt': self.alt if self.alt is not None else 'None',
                           'rank': self.rank})
772849
def obj_to_string(obj, top=True):
    
    obj = prepare_for_json_encoding(obj)
    if type(obj) == six.text_type:
        return obj
    return json.dumps(obj)
494240
def to_json(*a)
      # Hack to override RightScale namespace with Nanite for downward compatibility
      class_name = self.class.name
      if class_name =~ /^RightScale::(.*)/
        class_name = "Nanite::" + Regexp.last_match(1)
      end

      js = {
        'json_class' => class_name,
        'data'       => instance_variables.inject({}) do |m, ivar|
                          name = ivar.to_s.sub(/@/, '')
                          m[name] = instance_variable_get(ivar) unless NOT_SERIALIZED.include?(name)
                          m
                        end
      }.to_json(*a)
      @size = js.size
      js = js.chop + ",\"size\":#{@size}}"
    end