Skip to content

fix: handle scalar content values in JSONConverter - #12983

Open
Cha-Imaa wants to merge 1 commit into
deepset-ai:mainfrom
Cha-Imaa:fix/12953-json-converter-scalar-content
Open

Cha-Imaa wants to merge 1 commit into
deepset-ai:mainfrom
Cha-Imaa:fix/12953-json-converter-scalar-content

Conversation

@Cha-Imaa

Copy link
Copy Markdown

Related Issues

Proposed Changes

JSONConverter currently passes numeric and boolean content_key values directly to Document, which only accepts string or None content.

This change converts non-string scalar content_key values to strings before creating the Document, while preserving existing behavior for strings and None. Objects and lists continue to be skipped.

How did you test it?

  • Reproduced the issue with a numeric content_key value (123), which previously raised ValueError.
  • Added regression coverage for numeric and boolean scalar values.
  • pytest test/components/converters/test_json.py → 28 passed.
  • ruff check haystack/components/converters/json.py test/components/converters/test_json.py → passed.
  • ruff format --check haystack/components/converters/json.py test/components/converters/test_json.py → passed.

@Cha-Imaa
Cha-Imaa requested a review from a team as a code owner September 27, 2026 11:40
@Cha-Imaa
Cha-Imaa requested review from sjrl and removed request for a team September 27, 2026 11:40
@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

@Cha-Imaa is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Sep 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSONConverter fails on numeric and boolean content_key values

2 participants