I am trying to extract data from txt file in python which is a json dump. But I am getting JSONDecode Error
This is how I am adding json response into the file
repo=requests.get(url,headers=headers,params=params).json()
if repo:
with open('data.txt', 'a') as f:
json.dump(repo, f, sort_keys=True, indent=4)
continue
else:
break
this is my json structure
[
{
"login": "asu",
"login_name": "heylo"
},
{
"login": "sr9",
"login_name": "heylo"
}
],
[
{
"login": "tokuda109",
"login_name": "mojombo"
},
{
"login": "svallory",
"login_name": "mojombo"
}
]
this is I am trying to extract
with open('data.txt') as fd:
json_data = json.load(fd)
pprint(json_data)