A dictionary can supply a default for a missing field while preserving a stored false value.
import json
options = json.loads('{"hints": false}')
print(options.get("hints", True)) # False
print(options.get("sound", True)) # TrueThe default only applies when the key is absent. Handle the outer container in the same way when settings are nested.
Implement feature_enabled(text, name, default). Decode a JSON object whose optional features field maps feature names to booleans. Return the stored boolean for the named feature, or the supplied boolean default if the field or feature is absent.
feature_enabled('{"features":{"map":false}}', "map", True) # False