diff --git a/python_jsonschema_objects/classbuilder.py b/python_jsonschema_objects/classbuilder.py
index 4ba6006..ed55b99 100644
--- a/python_jsonschema_objects/classbuilder.py
+++ b/python_jsonschema_objects/classbuilder.py
@@ -39,6 +39,7 @@ class ProtocolBase(collections.MutableMapping):
     """
     __propinfo__ = {}
     __required__ = set()
+    __has_default__ = set()
     __object_attr_list__ = set(["_properties", "_extended_properties"])
 
     def as_dict(self):
@@ -158,6 +159,13 @@ class ProtocolBase(collections.MutableMapping):
                                     [None for x in
                                      six.moves.xrange(len(self.__prop_names__))]))
 
+        # To support defaults, we have to actually execute the constructors
+        # but only for the ones that have defaults set.
+        for name in self.__has_default__:
+            if name not in props:
+                logger.debug(util.lazy_format("Initializing '{0}' ", name))
+                setattr(self, name, None)
+
         for prop in props:
             try:
               logger.debug(util.lazy_format("Setting value for '{0}' to {1}", prop, props[prop]))
@@ -166,10 +174,9 @@ class ProtocolBase(collections.MutableMapping):
               import sys
               raise six.reraise(type(e), type(e)(str(e) + " \nwhile setting '{0}' in {1}".format(
                   prop, self.__class__.__name__)), sys.exc_info()[2])
+
         if getattr(self, '__strict__', None):
             self.validate()
-        #if len(props) > 0:
-        #    self.validate()
 
     def __setattr__(self, name, val):
         if name in self.__object_attr_list__:
@@ -277,7 +284,10 @@ class ProtocolBase(collections.MutableMapping):
 def MakeLiteral(name, typ, value, **properties):
     properties.update({'type': typ})
     klass = type(str(name), tuple((LiteralValue,)), {
-        '__propinfo__': {'__literal__': properties}
+        '__propinfo__': {
+            '__literal__': properties,
+            '__default__': properties.get('default')
+        }
     })
 
     return klass(value)
@@ -328,6 +338,9 @@ class LiteralValue(object):
       else:
           self._value = value
 
+      if self._value is None and self.default() is not None:
+          self._value = self.default()
+
       self.validate()
 
   def as_dict(self):
@@ -336,6 +349,10 @@ class LiteralValue(object):
   def for_json(self):
       return self._value
 
+  @classmethod
+  def default(cls):
+      return cls.__propinfo__.get('__default__')
+
   @classmethod
   def propinfo(cls, propname):
       if propname not in cls.__propinfo__:
@@ -516,7 +533,9 @@ class ClassBuilder(object):
 
       """
       cls = type(str(nm), tuple((LiteralValue,)), {
-        '__propinfo__': { '__literal__': clsdata}
+        '__propinfo__': {
+            '__literal__': clsdata,
+            '__default__': clsdata.get('default')}
         })
 
       return cls
@@ -525,6 +544,7 @@ class ClassBuilder(object):
         logger.debug(util.lazy_format("Building object {0}", nm))
 
         props = {}
+        defaults = set()
 
         properties = {}
         for p in parents:
@@ -541,6 +561,9 @@ class ClassBuilder(object):
             name_translation[prop] = prop.replace('@', '')
             prop = name_translation[prop]
 
+            if detail.get('default', None) is not None:
+                defaults.add(prop)
+
             if detail.get('type', None) == 'object':
                 uri = "{0}/{1}_{2}".format(nm,
                                            prop, "<anonymous>")
@@ -673,6 +696,7 @@ class ClassBuilder(object):
                                            .format(nm, invalid_requires))
 
         props['__required__'] = required
+        props['__has_default__'] = defaults
         if required and kw.get("strict"):
             props['__strict__'] = True
         cls = type(str(nm.split('/')[-1]), tuple(parents), props)
@@ -765,7 +789,10 @@ def make_property(prop, info, desc=""):
         elif getattr(info['type'], 'isLiteralClass', False) is True:
             if not isinstance(val, info['type']):
                 validator = info['type'](val)
-            validator.validate()
+                validator.validate()
+                if validator._value is not None:
+                    # This allows setting of default Literal values
+                    val = validator
 
         elif util.safe_issubclass(info['type'], ProtocolBase):
             if not isinstance(val, info['type']):

Feature request: implement default values
Would it be possible for the auto-generated class to implement any default values as specified in the JSON schema? Right now if I have a property defined as:

```
    "sample-boolean": {
      "description": "A sample boolean",
      "type": "boolean",
      "default": false
    }
```
and I instantiate an object of the generated class using obj = MyClass.from_json('{}') (or any JSON that does not include "sample-boolean") then obj.sample-boolean will be None instead of false.

Implementing the defaults would be a useful feature, I think.
diff --git a/test/test_pytest.py b/test/test_pytest.py
index 4e52b6f..70dea0e 100644
--- a/test/test_pytest.py
+++ b/test/test_pytest.py
@@ -493,3 +493,27 @@ def test_boolean_in_child_object():
     ns = builder.build_classes()
 
     ns.Test(data={"my_bool": True})
+
+
+
+@pytest.mark.parametrize('default', [
+    '{"type": "boolean", "default": false}',
+    '{"type": "string", "default": "Hello"}',
+    '{"type": "integer", "default": 500}'
+])
+def test_default_values(default):
+    default = json.loads(default)
+    schema = {
+        "$schema": "http://json-schema.org/schema#",
+        "id": "test",
+        "type": "object",
+        "properties": {
+            "sample": default
+        }
+    }
+
+    builder = pjs.ObjectBuilder(schema)
+    ns = builder.build_classes()
+
+    x = ns.Test()
+    assert x.sample == default['default']

pip install -e .[dev]
parse_log_pytest
requirements.txt
coverage pytest nose rednose pyandoc pandoc sphinx sphinx-autobuild recommonmark
3.5
requirements.txt development.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
colorama==0.4.5
commonmark==0.9.1
coverage==6.2
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
inflection==0.2.0
iniconfig==1.1.1
Jinja2==3.0.3
jsonschema==2.6.0
livereload==2.6.3
Markdown==2.4
MarkupSafe==2.0.1
nose==1.3.0
packaging==21.3
pandoc==2.4
pandocfilters==1.5.1
pluggy==1.0.0
plumbum==1.8.3
ply==3.11
py==1.11.0
pyandoc==0.2.0
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
-e git+https://github.com/cwacek/python-jsonschema-objects.git@ba178ce7680e14e4ac367a6fab5ea3655396668f#egg=python_jsonschema_objects
python-termstyle==0.1.10
pytz==2025.2
recommonmark==0.7.1
rednose==0.4.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-autobuild==2021.3.14
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
tornado==6.1
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: python-jsonschema-objects
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - colorama==0.4.5
      - commonmark==0.9.1
      - coverage==6.2
      - docutils==0.18.1
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - inflection==0.2.0
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - jsonschema==2.6.0
      - livereload==2.6.3
      - markdown==2.4
      - markupsafe==2.0.1
      - nose==1.3.0
      - packaging==21.3
      - pandoc==2.4
      - pandocfilters==1.5.1
      - pluggy==1.0.0
      - plumbum==1.8.3
      - ply==3.11
      - py==1.11.0
      - pyandoc==0.2.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pyrsistent==0.18.0
      - pytest==7.0.1
      - python-termstyle==0.1.10
      - pytz==2025.2
      - recommonmark==0.7.1
      - rednose==0.4.1
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-autobuild==2021.3.14
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==1.2.3
      - tornado==6.1
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/python-jsonschema-objects

test/test_pytest.py::test_default_values[{"type":
test/test_pytest.py::test_schema_validation test/test_pytest.py::test_regression_9 test/test_pytest.py::test_build_classes_is_idempotent test/test_pytest.py::test_underscore_properties test/test_pytest.py::test_array_regressions test/test_pytest.py::test_arrays_can_have_reffed_items_of_mixed_type test/test_pytest.py::test_regression_39 test/test_pytest.py::test_loads_markdown_schema_extraction test/test_pytest.py::test_object_builder_loads_memory_references test/test_pytest.py::test_object_builder_reads_all_definitions test/test_pytest.py::test_oneOf_validates_against_any_valid[{"MyData": test/test_pytest.py::test_oneOf_fails_against_non_matching test/test_pytest.py::test_oneOfBare_validates_against_any_valid[{"MyAddress": test/test_pytest.py::test_oneOfBare_validates_against_any_valid[{"firstName": test/test_pytest.py::test_oneOfBare_fails_against_non_matching test/test_pytest.py::test_additional_props_allowed_by_default test/test_pytest.py::test_additional_props_permitted_explicitly test/test_pytest.py::test_still_raises_when_accessing_undefined_attrs test/test_pytest.py::test_permits_deletion_of_additional_properties test/test_pytest.py::test_additional_props_disallowed_explicitly test/test_pytest.py::test_objects_can_be_empty test/test_pytest.py::test_object_equality_should_compare_data test/test_pytest.py::test_object_allows_attributes_in_oncstructor test/test_pytest.py::test_object_validates_on_json_decode test/test_pytest.py::test_object_validates_enumerations test/test_pytest.py::test_validation_of_mixed_type_enums test/test_pytest.py::test_objects_allow_non_required_attrs_to_be_missing test/test_pytest.py::test_objects_require_required_attrs_on_validate test/test_pytest.py::test_attribute_access_via_dict test/test_pytest.py::test_attribute_set_via_dict test/test_pytest.py::test_numeric_attribute_validation test/test_pytest.py::test_objects_validate_prior_to_serializing test/test_pytest.py::test_serializing_removes_null_objects test/test_pytest.py::test_lists_get_serialized_correctly test/test_pytest.py::test_dictionary_transformation[pdict0] test/test_pytest.py::test_dictionary_transformation[pdict1] test/test_pytest.py::test_strict_mode test/test_pytest.py::test_boolean_in_child_object
python_jsonschema_objects/classbuilder.py
python_jsonschema_objects/classbuilder.py