public JSONObject toJSON() {
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("night_or_day", _periodOfTime.toString().toLowerCase());
   jsonObject.put("date", DateUtils.getISO8601String(_date));
   jsonObject.put("icon_code", _iconCode);
   jsonObject.put("icon_uri", _iconURI);
   jsonObject.put("description", _description);
   jsonObject.put("description_long", _descriptionLong);
   jsonObject.put("geography", _geography.toJSON());
   jsonObject.put("units", _units.toString().toLowerCase());
   jsonObject.put("high_temp", _highTemperature);
   jsonObject.put("low_temp", _lowTemperature);
   jsonObject.put("effective_high_temp", _effectiveHighTemperature);
   jsonObject.put("effective_low_temp", _effectiveLowTemperature);
   jsonObject.put("wind_speed", _windSpeed);
   jsonObject.put("wind_gust", _windGust);
   jsonObject.put("wind_direction", _windDirection.toString().toLowerCase());
   jsonObject.put("max_uv", _maxUV);
   jsonObject.put("rain_amount", _rainAmount);
   jsonObject.put("snow_amount", _snowAmount);
   jsonObject.put("ice_amount", _iceAmount);
   jsonObject.put("total_precipitation", _totalPrecipitation);
   jsonObject.put("details_uri", _detailsURI);
   return (jsonObject);
 }
 public WeatherForecastVO(JSONObject jsonObject) throws APIProtocolException {
   super();
   if (jsonObject == null) throw new APIProtocolException();
   try {
     _periodOfTime = PeriodOfTime.valueOf(((String) jsonObject.get("night_or_day")).toUpperCase());
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _date = DateUtils.parseISO8601String((String) jsonObject.get("date"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _iconCode = (String) jsonObject.get("icon_code");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _iconURI = (String) jsonObject.get("icon_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _description = (String) jsonObject.get("description");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _descriptionLong = (String) jsonObject.get("description_long");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _geography = new GeographyVO((JSONObject) jsonObject.get("geography"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _units = MeasurementSystem.valueOf(((String) jsonObject.get("units")).toUpperCase());
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _scale =
         _units == MeasurementSystem.ENGLISH
             ? TemperatureScale.FAHRENHEIT
             : TemperatureScale.CELSIUS;
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _highTemperature = (Long) jsonObject.get("high_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _lowTemperature = (Long) jsonObject.get("low_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _effectiveHighTemperature = (Long) jsonObject.get("effective_high_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _effectiveLowTemperature = (Long) jsonObject.get("effective_low_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _windSpeed = (Long) jsonObject.get("wind_speed");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _windGust = (Long) jsonObject.get("wind_gust");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _windDirection = CardinalDirection.valueOf((String) jsonObject.get("wind_direction"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _maxUV = (String) jsonObject.get("max_uv");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _rainAmount = (Double) jsonObject.get("rain_amount");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _snowAmount = (Double) jsonObject.get("snow_amount");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _iceAmount = (Double) jsonObject.get("ice_amount");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _totalPrecipitation = (Double) jsonObject.get("total_precipitation");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _thunderstormProbability = (Long) jsonObject.get("thunderstorm_probability");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _detailsURI = (String) jsonObject.get("details_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
 }