I have a json file that looks like this:
[
{
"id": 1,
"first_name": "Clemens",
"last_name": "Parramore",
"email": "cparramore0@google.com",
"gender": "Male",
"ip_address": "223.150.139.137"
},
{
"id": 1000,
"first_name": "Theodore",
"last_name": "Agostini",
"email": "tagostinirr@archive.org",
"gender": "Male",
"ip_address": "6.131.228.196"
}
]
And I am trying to filter it so that if it contains certain characters it is saved in a new json. My method does not give results, the new file contains all the information from the original json:
f = open('./data/data.json','r')
data = json.load(f)
fj = open('new.json', 'w')
for line in str(data).split('{'):
if "google" in line:
print(line, end="\n")
fj.write(line)
However in the print I do get what I want. I know the method is wrong, can someone help me? Thank you