This commit is contained in:
louiscklaw
2025-01-31 20:05:06 +08:00
parent 2a6f19a43f
commit cd995ed8bd
115 changed files with 7626 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
jsonpath-ng = "*"
[dev-packages]
[requires]
python_version = "3.11"

36
ych1990101/jsonpath-tryout/Pipfile.lock generated Normal file
View File

@@ -0,0 +1,36 @@
{
"_meta": {
"hash": {
"sha256": "13e6ab508682901d9f54650d3c3fdbe343987158f038299e9b7b6f7480f0acae"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.11"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"jsonpath-ng": {
"hashes": [
"sha256:086c37ba4917304850bd837aeab806670224d3f038fe2833ff593a672ef0a5fa",
"sha256:8f22cd8273d7772eea9aaa84d922e0841aa36fdb8a2c6b7f6c3791a16a9bc0be"
],
"index": "pypi",
"version": "==1.6.1"
},
"ply": {
"hashes": [
"sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3",
"sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce"
],
"version": "==3.11"
}
},
"develop": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
import json
from jsonpath_ng import jsonpath, parse
with open("db.json", 'r') as json_file:
json_data = json.load(json_file)
# print(json_data)
jsonpath_expression = parse('leagueTable.homeTeam.all.teamPlayed')
for match in jsonpath_expression.find(json_data):
print(f'Employee id: {match.value}')