update,
This commit is contained in:
12
ych1990101/jsonpath-tryout/Pipfile
Normal file
12
ych1990101/jsonpath-tryout/Pipfile
Normal 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
36
ych1990101/jsonpath-tryout/Pipfile.lock
generated
Normal 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": {}
|
||||
}
|
1174
ych1990101/jsonpath-tryout/db.json
Normal file
1174
ych1990101/jsonpath-tryout/db.json
Normal file
File diff suppressed because it is too large
Load Diff
12
ych1990101/jsonpath-tryout/main.py
Normal file
12
ych1990101/jsonpath-tryout/main.py
Normal 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}')
|
Reference in New Issue
Block a user