Returns the JSON representation of the environment.
776339
def to_json(self):
        

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

        return result
204830
def json(self):
        
        return {
            'name': self.name,
            'message': self.message,
            'description': self.description,
            'reference_url': self.reference_url,
            'tags': self.tags,
        }
282212
def to_json(self):
        """"""
        return {
            'hum_type': self.hum_type,
            'hum_value': self.hum_value,
            'barometric_pressure': self.barometric_pressure,
            'schedule': self.schedule,
            'wet_bulb_range': self.wet_bulb_range,
        }
90789
def json(self):
        """"""
        if self._data_json:
            return self._data_json

        if not self.data or self.content_type != 'application/json':
            return None

        self._data_json = json.loads(self.data)
        return self._data_json
1352016
def to_JSON(self):
        
        return json.dumps({'reference_time': self._reference_time,
                           'sunset_time': self._sunset_time,
                           'sunrise_time': self._sunrise_time,
                           'clouds': self._clouds,
                           'rain': self._rain,
                           'snow': self._snow,
                           'wind': self._wind,
                           'humidity': self._humidity,
                           'pressure': self._pressure,
                           'temperature': self._temperature,
                           'status': self._status,
                           'detailed_status': self._detailed_status,
                           'weather_code': self._weather_code,
                           'weather_icon_name': self._weather_icon_name,
                           'visibility_distance': self._visibility_distance,
                           'dewpoint': self._dewpoint,
                           'humidex': self._humidex,
                           'heat_index': self._heat_index})
587023
def get_environments():
    """"""
    envs = []
    for root, subfolders, files in os.walk('environments'):
        for filename in files:
            if filename.endswith(".json"):
                path = os.path.join(
                    root[len('environments'):], filename[:-len('.json')])
                envs.append(get_environment(path))
    return sorted(envs, key=lambda x: x['name'])
928934
def as_json(self):
        
        info = {
            'host': self.host,
            'port': self.port,
            'geo': {
                'country': {'code': self._geo.code, 'name': self._geo.name},
                'region': {
                    'code': self._geo.region_code,
                    'name': self._geo.region_name,
                },
                'city': self._geo.city_name,
            },
            'types': [],
            'avg_resp_time': self.avg_resp_time,
            'error_rate': self.error_rate,
        }

        order = lambda tp_lvl: (len(tp_lvl[0]), tp_lvl[0][-1])  # noqa: 731
        for tp, lvl in sorted(self.types.items(), key=order):
            info['types'].append({'type': tp, 'level': lvl or ''})
        return info
226646
def _to_json(self):
        
        return dict(( (k, v) for k, v in self.__dict__.iteritems() if k != 'server'))
1010052
def to_json(self):
    
    return {self.NAMESPACE_RANGE_PARAM: self.ns_range.to_json_object(),
            self.BATCH_SIZE_PARAM: self._batch_size}
1066261
def _get_environment_details(python_bin: str) -> list:
    """"""
    cmd = "{} -m pipdeptree --json".format(python_bin)
    output = run_command(cmd, is_json=True).stdout
    return [_create_entry(entry) for entry in output]
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)
247944
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'environment_id') and self.environment_id is not None:
            _dict['environment_id'] = self.environment_id
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'description') and self.description is not None:
            _dict['description'] = self.description
        if hasattr(self, 'created') and self.created is not None:
            _dict['created'] = datetime_to_string(self.created)
        if hasattr(self, 'updated') and self.updated is not None:
            _dict['updated'] = datetime_to_string(self.updated)
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'read_only') and self.read_only is not None:
            _dict['read_only'] = self.read_only
        if hasattr(self, 'size') and self.size is not None:
            _dict['size'] = self.size
        if hasattr(self, 'requested_size') and self.requested_size is not None:
            _dict['requested_size'] = self.requested_size
        if hasattr(self, 'index_capacity') and self.index_capacity is not None:
            _dict['index_capacity'] = self.index_capacity._to_dict()
        if hasattr(self, 'search_status') and self.search_status is not None:
            _dict['search_status'] = self.search_status._to_dict()
        return _dict
1359303
def json(self):
        
        data = super(CalTRACKHourlyModel, self).json()
        data.update(
            {
                "occupancy_lookup": self.occupancy_lookup.to_json(orient="split"),
                "temperature_bins": self.temperature_bins.to_json(orient="split"),
            }
        )
        return data
1371785
def to_JSON(self):
        
        return json.dumps({"reference_time": self._reference_time,
                           "location": json.loads(self._location.to_JSON()),
                           "value": self._value,
                           "reception_time": self._reception_time,
                           })
606909
def to_json(self) -> Dict:
        """"""
        rv = {
            'network_ids': self.network_ids,
        }

        if self.seeding:
            rv['seeding'] = self.seeding.to_json()

        if self.pipeline:
            rv['pipeline'] = self.pipeline.to_json()

        return rv
1046248
def to_json(self):
        """"""
        return {
            'solar_model': self.solar_model,
            'month': self.month,
            'day_of_month': self.day_of_month,
            'daylight_savings_indicator': self.daylight_savings_indicator,
            'beam_shced': self.beam_shced,
            'diff_sched': self.diff_sched
        }
338891
def json(self, build_context) -> str:
        """"""
        if self._json is None:
            self.compute_json(build_context)
        return self._json