diff --git a/python_jsonschema_objects/classbuilder.py b/python_jsonschema_objects/classbuilder.py
index 0313909..8178397 100644
--- a/python_jsonschema_objects/classbuilder.py
+++ b/python_jsonschema_objects/classbuilder.py
@@ -213,6 +213,7 @@ class ProtocolBase(collections.MutableMapping):
             self.validate()
 
     def __setattr__(self, name, val):
+        name = str(name)
         if name in self.__object_attr_list__:
             object.__setattr__(self, name, val)
         elif name in self.__propinfo__:
@@ -252,6 +253,7 @@ class ProtocolBase(collections.MutableMapping):
             raise KeyError(key)
 
     def __getattr__(self, name):
+        name = str(name)
         if name in self.__prop_names__:
             raise AttributeError(name)
         if name in self._extended_properties:
@@ -261,12 +263,15 @@ class ProtocolBase(collections.MutableMapping):
         )
 
     def __setitem__(self, key, val):
+        key = str(key)
         return setattr(self, key, val)
 
     def __delitem__(self, key):
+        key = str(key)
         return delattr(self, key)
 
     def __delattr__(self, name):
+        name = str(name)
         if name in self._extended_properties:
             del self._extended_properties[name]
             return

automatically convert keys in property access
I often use properties of pjs objects as keys in other objects (i.e., dictionary lookup), such as in
```python
o = orgs[handle.key]
```
with `handle` and `orgs` both being instances of `ProtocolBase`.
This, however, does not work since Python expects a string here, and throws a `TypeError`:
```
TypeError: getattr(): attribute name must be string
```

To work around this, I need to call `str()` explicitly, as in:
```python
o = orgs[str(handle.key)]
```
It would be convinient, if the `__getattr__`, `__setattr__`, `__delattr__`, … functions could cast `Literal<str>` to `str` themselves (they could, e.g., always call `str()` unconditionally since the key to lookup an object property must be a string).
diff --git a/test/test_feature_177.py b/test/test_feature_177.py
new file mode 100644
index 0000000..576aa01
--- /dev/null
+++ b/test/test_feature_177.py
@@ -0,0 +1,38 @@
+import pytest
+
+import python_jsonschema_objects as pjo
+
+
+@pytest.fixture
+def classes():
+
+    schema = {
+        "title": "Config",
+        "type": "object",
+        "additionalProperties": {"$ref": "#/definitions/Parameter"},
+        "definitions": {
+            "Parameter": {
+                "$id": "Parameter",
+                "type": "object",
+                "properties": {
+                    "key": {"type": "string"},
+                    "value": {"oneOf": [{"type": "string"}, {"type": "number"}]},
+                },
+            }
+        },
+    }
+
+    return pjo.ObjectBuilder(schema).build_classes()
+
+
+def test_pjo_objects_can_be_used_as_property_keys(classes):
+    container = classes.Config()
+    obj1 = classes.Parameter(key="volume", value=11)
+    obj2 = classes.Parameter(key="compression", value="on")
+
+    container[obj1.key] = obj1
+    container[obj2.key] = obj2
+
+    assert container.volume.value == 11
+
+    assert sorted(container.keys()) == sorted(str(k) for k in [obj1.key, obj2.key])
diff --git a/test/test_pytest.py b/test/test_pytest.py
index 415101d..2ae8a5e 100644
--- a/test/test_pytest.py
+++ b/test/test_pytest.py
@@ -402,6 +402,19 @@ def test_attribute_set_via_dict(person_object):
     assert str(name) == "John"
 
 
+def test_keys_can_be_other_pjo_objects(Person, person_object):
+    person_object.lastName = "Smith"
+
+    jane = Person(firstName="Jane", lastName=person_object.lastName)
+
+    assert jane.lastName == person_object.lastName
+
+    # We don't want the names to be the same literal object though.
+    # Changing one after assignment should not change the other
+    jane.lastName = "Borges"
+    assert jane.lastName != person_object.lastName
+
+
 def test_numeric_attribute_validation(Person):
     with pytest.raises(pjs.ValidationError):
         Person(firstName="James", lastName="Bond", age=-10)

pip install -e .[dev]
parse_log_pytest
requirements.txt
3.6
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
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
inflection==0.5.1
iniconfig==1.1.1
Jinja2==3.0.3
jsonschema==3.2.0
livereload==2.6.3
Markdown==3.3.7
MarkupSafe==2.0.1
nose==1.3.0
packaging==21.3
pandoc==2.4
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
pytest-mock==3.6.1
-e git+https://github.com/cwacek/python-jsonschema-objects.git@6e34b75e00afbab3e92cd0fee958165ac3ac14e8#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
      - docutils==0.18.1
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - inflection==0.5.1
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - jsonschema==3.2.0
      - livereload==2.6.3
      - markdown==3.3.7
      - markupsafe==2.0.1
      - nose==1.3.0
      - packaging==21.3
      - pandoc==2.4
      - 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
      - pytest-mock==3.6.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_feature_177.py::test_pjo_objects_can_be_used_as_property_keys
test/test_pytest.py::test_warnings_on_schema_version[http://json-schema.org/schema#-True] test/test_pytest.py::test_warnings_on_schema_version[http://json-schema.org/draft-03/schema-False] test/test_pytest.py::test_warnings_on_schema_version[http://json-schema.org/draft-04/schema-False] test/test_pytest.py::test_warnings_on_schema_version[http://json-schema.org/draft-06/schema-True] test/test_pytest.py::test_warnings_on_schema_version[http://json-schema.org/draft-07/schema-True] 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_keys_can_be_other_pjo_objects 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 test/test_pytest.py::test_default_values[{"type":
python_jsonschema_objects/classbuilder.py
python_jsonschema_objects/classbuilder.py