diff --git a/stix2/base.py b/stix2/base.py
index a283902..4248075 100644
--- a/stix2/base.py
+++ b/stix2/base.py
@@ -388,14 +388,12 @@ class _Observable(_STIXBase):
                         temp_deep_copy = copy.deepcopy(dict(kwargs[key]))
                         _recursive_stix_to_dict(temp_deep_copy)
                         streamlined_obj_vals.append(temp_deep_copy)
-                    elif isinstance(kwargs[key], list) and isinstance(kwargs[key][0], _STIXBase):
-                        for obj in kwargs[key]:
-                            temp_deep_copy = copy.deepcopy(dict(obj))
-                            _recursive_stix_to_dict(temp_deep_copy)
-                            streamlined_obj_vals.append(temp_deep_copy)
+                    elif isinstance(kwargs[key], list):
+                        temp_deep_copy = copy.deepcopy(kwargs[key])
+                        _recursive_stix_list_to_dict(temp_deep_copy)
+                        streamlined_obj_vals.append(temp_deep_copy)
                     else:
                         streamlined_obj_vals.append(kwargs[key])
-
             if streamlined_obj_vals:
                 data = canonicalize(streamlined_obj_vals, utf8=False)
 
@@ -448,5 +446,20 @@ def _recursive_stix_to_dict(input_dict):
 
             # There may stil be nested _STIXBase objects
             _recursive_stix_to_dict(input_dict[key])
+        elif isinstance(input_dict[key], list):
+            _recursive_stix_list_to_dict(input_dict[key])
         else:
-            return
+            pass
+
+
+def _recursive_stix_list_to_dict(input_list):
+    for i in range(len(input_list)):
+        if isinstance(input_list[i], _STIXBase):
+            input_list[i] = dict(input_list[i])
+        elif isinstance(input_list[i], dict):
+            pass
+        elif isinstance(input_list[i], list):
+            _recursive_stix_list_to_dict(input_list[i])
+        else:
+            continue
+        _recursive_stix_to_dict(input_list[i])

File SCO with WindowsPEBinary using WindowsPESection causes JSON serialization error
Below an example of how to trigger the problem:

``` python
from stix2.v21 import observables

directory_observable = observables.Directory(path="/home/user-1/")
file_observable = observables.File(
    name="example.exe",
    parent_directory_ref=directory_observable["id"],
    size=68 * 1000,
    magic_number_hex="50000000",
    hashes={
        "SHA-256": "841a8921140aba50671ebb0770fecc4ee308c4952cfeff8de154ab14eeef4649"
    },
    extensions={"windows-pebinary-ext": observables.WindowsPEBinaryExt(pe_type="exe", machine_hex="014c", sections=[observables.WindowsPESection(name=".data", size=4096, entropy=7.980693, hashes={"SHA-256": "6e3b6f3978e5cd96ba7abee35c24e867b7e64072e2ecb22d0ee7a6e6af6894d0"})])}
)
print(directory_observable, file_observable)
```

I obtain the following error:

```
Traceback (most recent call last):
  File "C:/Users/user-1/home/example_project/exe_report.py", line 69, in <module>
    exe_report()
  File "C:/Users/user-1/home/example_project/exe_report.py", line 45, in exe_report
    extensions={"windows-pebinary-ext": observables.WindowsPEBinaryExt(pe_type="exe", machine_hex="014c", sections=[observables.WindowsPESection(name=".data", size=4096, entropy=7.980693, hashes={"SHA-256": "6e3b6f3978e5cd96ba7abee35c24e867b7e64072e2ecb22d0ee7a6e6af6894d0"})])}
  File "C:\Users\user-1\venv\lib\site-packages\stix2\base.py", line 317, in __init__
    possible_id = self._generate_id(kwargs)
  File "C:\Users\user-1\venv\lib\site-packages\stix2\base.py", line 395, in _generate_id
    data = canonicalize(streamlined_obj_vals, utf8=False)
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 502, in canonicalize
    textVal = JSONEncoder(sort_keys=True).encode(obj)
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 233, in encode
    chunks = list(chunks)
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 478, in _iterencode
    for thing in _iterencode_list(o, _current_indent_level):
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 367, in _iterencode_list
    for chunk in chunks:
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 450, in _iterencode_dict
    for chunk in chunks:
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 450, in _iterencode_dict
    for chunk in chunks:
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 367, in _iterencode_list
    for chunk in chunks:
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 491, in _iterencode
    o = _default(o)
  File "C:\Users\user-1\venv\lib\site-packages\stix2\canonicalization\Canonicalize.py", line 211, in default
    o.__class__.__name__,
TypeError: Object of type 'WindowsPESection' is not JSON serializable
```
diff --git a/stix2/test/v21/test_observed_data.py b/stix2/test/v21/test_observed_data.py
index 6f36d88..71bad46 100644
--- a/stix2/test/v21/test_observed_data.py
+++ b/stix2/test/v21/test_observed_data.py
@@ -1538,3 +1538,47 @@ def test_deterministic_id_no_contributing_props():
     uuid_obj_2 = uuid.UUID(email_msg_2.id[-36:])
     assert uuid_obj_2.variant == uuid.RFC_4122
     assert uuid_obj_2.version == 4
+
+
+def test_id_gen_recursive_dict_conversion_1():
+    file_observable = stix2.v21.File(
+        name="example.exe",
+        size=68 * 1000,
+        magic_number_hex="50000000",
+        hashes={
+            "SHA-256": "841a8921140aba50671ebb0770fecc4ee308c4952cfeff8de154ab14eeef4649",
+        },
+        extensions={
+            "windows-pebinary-ext": stix2.v21.WindowsPEBinaryExt(
+                pe_type="exe",
+                machine_hex="014c",
+                sections=[
+                    stix2.v21.WindowsPESection(
+                        name=".data",
+                        size=4096,
+                        entropy=7.980693,
+                        hashes={"SHA-256": "6e3b6f3978e5cd96ba7abee35c24e867b7e64072e2ecb22d0ee7a6e6af6894d0"},
+                    ),
+                ],
+            ),
+        },
+    )
+
+    assert file_observable.id == "file--5219d93d-13c1-5f1f-896b-039f10ec67ea"
+
+
+def test_id_gen_recursive_dict_conversion_2():
+    wrko = stix2.v21.WindowsRegistryKey(
+        values=[
+            stix2.v21.WindowsRegistryValueType(
+                name="Foo",
+                data="qwerty",
+            ),
+            stix2.v21.WindowsRegistryValueType(
+                name="Bar",
+                data="42",
+            ),
+        ],
+    )
+
+    assert wrko.id == "windows-registry-key--c087d9fe-a03e-5922-a1cd-da116e5b8a7b"

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov taxii2-client fuzzywuzzy haversine python-Levenshtein medallion
apt-get update apt-get install -y gcc
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
antlr4-python3-runtime==4.9.3
attrs==24.2.0
Babel==2.14.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.0.0
bump2version==1.0.1
bumpversion==0.6.0
cachetools==5.5.2
certifi @ file:///croot/certifi_1671487769961/work/certifi
cfgv==3.3.1
chardet==5.2.0
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
coverage==7.2.7
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.9
docutils==0.17.1
entrypoints==0.4
exceptiongroup==1.2.2
fastjsonschema==2.21.1
filelock==3.12.2
Flask==2.2.5
Flask-HTTPAuth==4.8.0
fuzzywuzzy==0.18.0
haversine==2.9.0
identify==2.5.24
idna==3.10
imagesize==1.4.1
importlib-metadata==6.7.0
importlib-resources==5.12.0
iniconfig==2.0.0
ipython==7.34.0
itsdangerous==2.1.2
jedi==0.19.2
Jinja2==3.1.6
jsonschema==4.17.3
jupyter_client==7.4.9
jupyter_core==4.12.0
jupyterlab-pygments==0.2.2
Levenshtein==0.23.0
MarkupSafe==2.1.5
matplotlib-inline==0.1.6
medallion==3.0.0
mistune==3.0.2
nbclient==0.7.4
nbconvert==7.6.0
nbformat==5.8.0
nbsphinx==0.4.3
nest-asyncio==1.6.0
nodeenv==1.9.1
packaging==24.0
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pkgutil_resolve_name==1.3.10
platformdirs==4.0.0
pluggy==1.2.0
pre-commit==2.21.0
prompt_toolkit==3.0.48
ptyprocess==0.7.0
Pygments==2.17.2
pyproject-api==1.5.3
pyrsistent==0.19.3
pytest==7.4.4
pytest-cov==4.1.0
python-dateutil==2.9.0.post0
python-Levenshtein==0.23.0
pytz==2025.2
PyYAML==6.0.1
pyzmq==26.2.1
rapidfuzz==3.4.0
requests==2.31.0
simplejson==3.20.1
six==1.17.0
snowballstemmer==2.2.0
soupsieve==2.4.1
Sphinx==1.8.6
sphinx-prompt==1.5.0
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-websupport==1.2.4
-e git+https://github.com/oasis-open/cti-python-stix2.git@148d672b24552917d1666da379fbb3d7e85e1bc8#egg=stix2
stix2-patterns==2.0.0
taxii2-client==2.3.0
tinycss2==1.2.1
tomli==2.0.1
tornado==6.2
tox==4.8.0
traitlets==5.9.0
typing_extensions==4.7.1
urllib3==2.0.7
virtualenv==20.26.6
wcwidth==0.2.13
webencodings==0.5.1
Werkzeug==2.2.3
zipp==3.15.0

name: cti-python-stix2
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=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - 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=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - antlr4-python3-runtime==4.9.3
      - attrs==24.2.0
      - babel==2.14.0
      - backcall==0.2.0
      - beautifulsoup4==4.13.3
      - bleach==6.0.0
      - bump2version==1.0.1
      - bumpversion==0.6.0
      - cachetools==5.5.2
      - cfgv==3.3.1
      - chardet==5.2.0
      - charset-normalizer==3.4.1
      - click==8.1.8
      - colorama==0.4.6
      - coverage==7.2.7
      - decorator==5.1.1
      - defusedxml==0.7.1
      - distlib==0.3.9
      - docutils==0.17.1
      - entrypoints==0.4
      - exceptiongroup==1.2.2
      - fastjsonschema==2.21.1
      - filelock==3.12.2
      - flask==2.2.5
      - flask-httpauth==4.8.0
      - fuzzywuzzy==0.18.0
      - haversine==2.9.0
      - identify==2.5.24
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==6.7.0
      - importlib-resources==5.12.0
      - iniconfig==2.0.0
      - ipython==7.34.0
      - itsdangerous==2.1.2
      - jedi==0.19.2
      - jinja2==3.1.6
      - jsonschema==4.17.3
      - jupyter-client==7.4.9
      - jupyter-core==4.12.0
      - jupyterlab-pygments==0.2.2
      - levenshtein==0.23.0
      - markupsafe==2.1.5
      - matplotlib-inline==0.1.6
      - medallion==3.0.0
      - mistune==3.0.2
      - nbclient==0.7.4
      - nbconvert==7.6.0
      - nbformat==5.8.0
      - nbsphinx==0.4.3
      - nest-asyncio==1.6.0
      - nodeenv==1.9.1
      - packaging==24.0
      - pandocfilters==1.5.1
      - parso==0.8.4
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pkgutil-resolve-name==1.3.10
      - platformdirs==4.0.0
      - pluggy==1.2.0
      - pre-commit==2.21.0
      - prompt-toolkit==3.0.48
      - ptyprocess==0.7.0
      - pygments==2.17.2
      - pyproject-api==1.5.3
      - pyrsistent==0.19.3
      - pytest==7.4.4
      - pytest-cov==4.1.0
      - python-dateutil==2.9.0.post0
      - python-levenshtein==0.23.0
      - pytz==2025.2
      - pyyaml==6.0.1
      - pyzmq==26.2.1
      - rapidfuzz==3.4.0
      - requests==2.31.0
      - simplejson==3.20.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - soupsieve==2.4.1
      - sphinx==1.8.6
      - sphinx-prompt==1.5.0
      - sphinxcontrib-serializinghtml==1.1.5
      - sphinxcontrib-websupport==1.2.4
      - stix2-patterns==2.0.0
      - taxii2-client==2.3.0
      - tinycss2==1.2.1
      - tomli==2.0.1
      - tornado==6.2
      - tox==4.8.0
      - traitlets==5.9.0
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - virtualenv==20.26.6
      - wcwidth==0.2.13
      - webencodings==0.5.1
      - werkzeug==2.2.3
      - zipp==3.15.0
prefix: /opt/conda/envs/cti-python-stix2

stix2/test/v21/test_observed_data.py::test_id_gen_recursive_dict_conversion_1 stix2/test/v21/test_observed_data.py::test_id_gen_recursive_dict_conversion_2
stix2/test/v21/test_observed_data.py::test_observed_data_example stix2/test/v21/test_observed_data.py::test_observed_data_example_with_refs stix2/test/v21/test_observed_data.py::test_observed_data_example_with_object_refs stix2/test/v21/test_observed_data.py::test_observed_data_object_constraint stix2/test/v21/test_observed_data.py::test_observed_data_example_with_bad_refs stix2/test/v21/test_observed_data.py::test_observed_data_example_with_non_dictionary stix2/test/v21/test_observed_data.py::test_observed_data_example_with_empty_dictionary stix2/test/v21/test_observed_data.py::test_parse_observed_data[{\n stix2/test/v21/test_observed_data.py::test_parse_observed_data[data1] stix2/test/v21/test_observed_data.py::test_parse_artifact_valid["0": stix2/test/v21/test_observed_data.py::test_parse_artifact_invalid["0": stix2/test/v21/test_observed_data.py::test_artifact_example_dependency_error stix2/test/v21/test_observed_data.py::test_parse_autonomous_system_valid["0": stix2/test/v21/test_observed_data.py::test_parse_email_address[{\n stix2/test/v21/test_observed_data.py::test_parse_email_message[\n stix2/test/v21/test_observed_data.py::test_parse_email_message_not_multipart[\n stix2/test/v21/test_observed_data.py::test_parse_file_archive["0": stix2/test/v21/test_observed_data.py::test_parse_email_message_with_at_least_one_error[\n stix2/test/v21/test_observed_data.py::test_parse_basic_tcp_traffic[\n stix2/test/v21/test_observed_data.py::test_parse_basic_tcp_traffic_with_error[\n stix2/test/v21/test_observed_data.py::test_observed_data_with_process_example stix2/test/v21/test_observed_data.py::test_artifact_example stix2/test/v21/test_observed_data.py::test_artifact_mutual_exclusion_error stix2/test/v21/test_observed_data.py::test_directory_example stix2/test/v21/test_observed_data.py::test_directory_example_ref_error stix2/test/v21/test_observed_data.py::test_domain_name_example stix2/test/v21/test_observed_data.py::test_domain_name_example_invalid_ref_type stix2/test/v21/test_observed_data.py::test_file_example stix2/test/v21/test_observed_data.py::test_file_example_with_NTFSExt stix2/test/v21/test_observed_data.py::test_file_example_with_empty_NTFSExt stix2/test/v21/test_observed_data.py::test_file_example_with_PDFExt stix2/test/v21/test_observed_data.py::test_file_example_with_PDFExt_Object stix2/test/v21/test_observed_data.py::test_file_example_with_RasterImageExt_Object stix2/test/v21/test_observed_data.py::test_raster_image_ext_parse stix2/test/v21/test_observed_data.py::test_raster_images_ext_create stix2/test/v21/test_observed_data.py::test_file_example_with_WindowsPEBinaryExt stix2/test/v21/test_observed_data.py::test_file_example_encryption_error stix2/test/v21/test_observed_data.py::test_ipv4_address_example stix2/test/v21/test_observed_data.py::test_ipv4_address_valid_refs stix2/test/v21/test_observed_data.py::test_ipv4_address_example_cidr stix2/test/v21/test_observed_data.py::test_ipv6_address_example stix2/test/v21/test_observed_data.py::test_mac_address_example stix2/test/v21/test_observed_data.py::test_network_traffic_example stix2/test/v21/test_observed_data.py::test_network_traffic_http_request_example stix2/test/v21/test_observed_data.py::test_network_traffic_icmp_example stix2/test/v21/test_observed_data.py::test_network_traffic_socket_example stix2/test/v21/test_observed_data.py::test_correct_socket_options stix2/test/v21/test_observed_data.py::test_incorrect_socket_options stix2/test/v21/test_observed_data.py::test_network_traffic_tcp_example stix2/test/v21/test_observed_data.py::test_mutex_example stix2/test/v21/test_observed_data.py::test_process_example stix2/test/v21/test_observed_data.py::test_process_example_empty_error stix2/test/v21/test_observed_data.py::test_process_example_empty_with_extensions stix2/test/v21/test_observed_data.py::test_process_example_windows_process_ext stix2/test/v21/test_observed_data.py::test_process_example_windows_process_ext_empty stix2/test/v21/test_observed_data.py::test_process_example_extensions_empty stix2/test/v21/test_observed_data.py::test_process_example_with_WindowsProcessExt_Object stix2/test/v21/test_observed_data.py::test_process_example_with_WindowsServiceExt stix2/test/v21/test_observed_data.py::test_process_example_with_WindowsProcessServiceExt stix2/test/v21/test_observed_data.py::test_software_example stix2/test/v21/test_observed_data.py::test_url_example stix2/test/v21/test_observed_data.py::test_user_account_example stix2/test/v21/test_observed_data.py::test_user_account_unix_account_ext_example stix2/test/v21/test_observed_data.py::test_windows_registry_key_example stix2/test/v21/test_observed_data.py::test_x509_certificate_example stix2/test/v21/test_observed_data.py::test_x509_certificate_error stix2/test/v21/test_observed_data.py::test_new_version_with_related_objects stix2/test/v21/test_observed_data.py::test_objects_deprecation stix2/test/v21/test_observed_data.py::test_deterministic_id_same_extra_prop_vals stix2/test/v21/test_observed_data.py::test_deterministic_id_diff_extra_prop_vals stix2/test/v21/test_observed_data.py::test_deterministic_id_diff_contributing_prop_vals stix2/test/v21/test_observed_data.py::test_deterministic_id_no_contributing_props
stix2/base.py
stix2/base.py