Skip to content

docs: fix Pydantic v2 JSON output in quickstart - #330

Merged
dapper91 merged 1 commit into
dapper91:devfrom
dajiaohuang:docs/quickstart-pydantic-v2-json-20261016
Oct 18, 2026
Merged

dapper91 merged 1 commit into
dapper91:devfrom
dajiaohuang:docs/quickstart-pydantic-v2-json-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

Problem

The quickstart's XML-to-JSON example calls company.json(indent=4). On the Pydantic v2 branch, executing that snippet after loading the documented Company example raises:

TypeError: `dumps_kwargs` keyword arguments are no longer supported.

No JSON output is written. Use Pydantic v2's model_dump_json(indent=4) instead; no library behavior changes.

Validation

  • Executed the quickstart JSON code block with the documented Company model and example XML: original failed with the exception above; corrected snippet writes JSON matching the parsed model.
  • Public examples: 49 passed with lxml; 48 passed and 1 backend-specific skip with ElementTree (Python 3.13, Pydantic 2.14.1, lxml 6.1.3). The binary-input custom-encoder example used the repository's committed LF fixture bytes rather than Windows checkout CRLF conversion.
  • Synthetic public-API roundtrips for namespaced attributes/elements, generics, a field validator, a discriminated union and an in-memory XML tree passed on both backends.
  • Sphinx 5.3 HTML build passed on Python 3.12 with intersphinx inventories disabled; external-reference availability was not checked.
  • git diff --check passed. Full test/version matrix and CI were not run locally.

@dapper91
dapper91 merged commit 49c9ef5 into dapper91:dev Oct 18, 2026
0 of 7 checks passed
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.

2 participants