public function jsonSerialize()
    {
        $result = array();
        foreach (get_object_vars($this) as $k => $v) {
            // $v is not checked for null like other jsonSerialize functions, all values should be defined here

            // Two special cases occur because they require sublevels in their JSON
            // encoding to be considered valid.
            if ($k == "months") {
                $result[$k] = array("month" => $this->months);
            }
            else if ($k == "weekDays") {
                $result[$k] = array("day" => $this->weekDays);
            }
            else {
                $result[$k] = $v;
            }
        }
        return array($this->name() => $result);
    }