Key 'boot_num' is not recognized when being interpreted from a .JSON file

Solution 1:

You can show the data using:

print(spcInfData)

This shows it to be a dictionary, whose single entry 'spec' has an array, whose zero'th element is a sub-dictionary, whose 'boot_num' entry is an integer.

{'spec': [{'os': 'name', 'os_type': 'getwindowsversion', 'lang': 'en', 'cpu_amt': 'cpu_count', 'storage_amt': 'unk', 'boot_num': 1}]}

So what you are looking for is

boot_num = spcInfData['spec'][0]['boot_num']

and note that the value obtained this way is already an integer. str() is not necessary.

It's also good practice to guard against file format errors so the program handles them gracefully.

try:
    boot_num = spcInfData['spec'][0]['boot_num']
except (KeyError, IndexError):
    print('Database is corrupt')

Issue Number 2

"Not serializable" means there is something somewhere in your data structure that is not an accepted type and can't be converted to a JSON string.

json.dump() only processes certain types such as strings, dictionaries, and integers. That includes all of the objects that are nested within sub-dictionaries, sub-arrays, etc. See documentation for json.JSONEncoder for a complete list of allowable types.