Files
004_comission/ych1990101/jsonpath-tryout/main.py
louiscklaw cd995ed8bd update,
2025-01-31 20:05:06 +08:00

13 lines
310 B
Python

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}')