There is a json file that has data I am looking to throw into a database, but there are over 10000 entries. So I want to automate it.
Here is an example of the parsed json code through python:
{'product': {'product_data': [{'product_name': 'debian_linux',
'version': {'version_data': [{'version_value': '8.0'}]}}]},
'vendor_name': 'debian'}]}},
'data_format': 'MITRE',
'data_type': 'CVE',
'data_version': '4.0',
basically where it says 'product_name': 'debian_linux'
is what I'm after. I want to print out each product name in the json file, but only show 1 of the product_name
if it has more than one entry (ex: there could be like 15 mentions of debian_linux, or windows_server_2008, but I only want to see one of those fifteen.)
I read the documentation for the jsons
library, but it's hard to understand without having much experience with coding, but I gave it a shot and here is my code so far:
import json
from pprint import pprint
with open('nvd.json') as f:
data = json.load(f)
pprint(data["product_name"])
I get an error saying KeyError: 'product_name'