I have written a simple service which, if sent the name of a football player, will return the team of said footballer. It's a learning project for myself.
I want to test the accuracy of my service.
I have made a JSON file with a list of footballers and their expected team. I want to send this off to my service and create a report to see how accurate I am.
The JSON looks like this -
{"Team": "Man Utd", "Players": "Ryan Giggs"}
{"Team": "Chelsea", "Players": "John Terry"}
.....
A simple start on my code -
import json
from pprint import pprint
with open('C:\\Users\\ADMIN\\Desktop\\Service_Testing\\service_json.json') as data_file:
data = json.load(data_file)
pprint(data)
Trying to load it in, however, I get the error -
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 47)
What is going wrong here? How can I load my JSON correctly? There are 46k lines in my json file which may be part of the issue !!
Aucun commentaire:
Enregistrer un commentaire