Skip to content

Fix numeric object keys in JSON path patterns - #332

Open
bensynapse wants to merge 1 commit into
lundberg:masterfrom
bensynapse:fix-numeric-json-paths
Open

bensynapse wants to merge 1 commit into
lundberg:masterfrom
bensynapse:fix-numeric-json-paths

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

JSON path patterns treat numeric object keys as integers. For example, json__0="zero" fails to match {"0": "zero"}.

Keep object keys as strings during traversal. This preserves leading zeros and numeric keys inside arrays. Existing array indexing is unchanged.

Added nine cases to the existing path tests. Six fail before the fix. The JSON reference includes a mixed object and array example.

Checked the Nox test sessions on Python 3.8 through 3.14, using nox -N -s test-3.11 and the corresponding version names.
Each reports 330 passed, two expected remote test skips, and 100% coverage.

nox -N -s mypy, nox -N -s docs and pre-commit run --all-files pass.
Both package builds and twine check dist/* pass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant