I need to process 10k JSON files in a folder called "All_Files", having names as Result_1.json, Result_2.json and so on, and having the following structure:
{
"kind": "string",
"url": {
"type": "application/json",
"template": "string"
},
"items": [
{
"kind": "string",
"link": "https://www.somewhere.com/..."
},
{
"kind": "string",
"link": "https://www.anywhere.com/..."
},
{
"kind": "string",
"link": "https://www.nowhere.com/..."
},
...
}
]
}
It is to be noted that a single JSON file may or may not contain an "items" array. Also, if the "items" array is present, then it can contain one or more objects as given in the example above. The "link" key contains full URLs. If the "items" array is present, then I need to access the "link" key and search for a specific substring that begins with "https://www.nowhere.com". There could be additional string after "https://www.nowhere.com" in a "link" key, but I need to match only the first part as described. If the first part matches, we need to save the name of the .JSON file having this particular key value in a text file called "Found.txt", one unquoted filename on each line in the file.
Please help me in writing a Python script that does this.