Skip to content

Support CRLF fenced JSON extraction#7889

Open
CodingFeng101 wants to merge 1 commit into
microsoft:mainfrom
CodingFeng101:codex/agent-small-fix
Open

Support CRLF fenced JSON extraction#7889
CodingFeng101 wants to merge 1 commit into
microsoft:mainfrom
CodingFeng101:codex/agent-small-fix

Conversation

@CodingFeng101

Copy link
Copy Markdown

What changed

This allows extract_json_from_str() to parse fenced JSON code blocks that use CRLF line endings after the opening fence.

Why

The extractor already supports markdown-style fenced JSON blocks, but the regex only accepted \n immediately after the opening fence. A valid block such as json\r\n... was not matched, so the function fell back to parsing the entire markdown string as JSON and failed.

Validation

  • .\.venv\Scripts\python -m pytest python/packages/autogen-core/tests/test_json_extraction.py -q
  • python -m ruff check python/packages/autogen-core/src/autogen_core/utils/_load_json.py python/packages/autogen-core/tests/test_json_extraction.py
  • git diff --check

@CodingFeng101

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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