Skip to content

Fix nested JSON parameter normalization#25

Open
adsharma wants to merge 1 commit into
mainfrom
fix/nested-json-parameters
Open

Fix nested JSON parameter normalization#25
adsharma wants to merge 1 commit into
mainfrom
fix/nested-json-parameters

Conversation

@adsharma
Copy link
Copy Markdown
Contributor

Summary

Fix to_json($param) handling for Python JSON parameters that contain mixed scalar and nested values in the same list.

Root Cause

The JSON parameter normalization path only forced JSON serialization for empty or otherwise unresolved nested shapes. Lists like ["entry1", "entry2", {"key": "value"}] were treated as typed parameters even though their mixed scalar/object structure is a JSON shape.

Changes

  • Detect mixed scalar and nested list elements as requiring JSON serialization.
  • Add an integration regression for nested @context JSON data.
  • Add a normalization regression that ensures this path does not import NumPy for non-NumPy users.

Validation

  • uv run pytest test/test_json.py test/test_parameter.py test/test_issue.py::test_issue_483_numpy_ndarray_parameter -q
  • uvx ruff check src_py/connection.py test/test_json.py

@adsharma adsharma marked this pull request as ready for review May 30, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant