We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d80c353 commit 3054ca4Copy full SHA for 3054ca4
jsonpath/jsonpath.py
@@ -212,7 +212,8 @@ def _build_path(path: str, key) -> str:
212
"""
213
if isinstance(key, int):
214
return f"{path}[{key}]"
215
- if JSONPath.REP_WORD_KEY.match(key):
+ # Fast check: if all chars are word chars (alphanumeric + underscore)
216
+ if key.isidentifier() or (key and key.replace("_", "a").isalnum()):
217
return f"{path}.{key}"
218
return f"{path}['{key}']"
219
0 commit comments