Python Json Periksa apakah ada kunci
import json
if 'id' not in dest:
dest['id'] = -1
targetId = dest['id']
Kaeffa
import json
if 'id' not in dest:
dest['id'] = -1
targetId = dest['id']
if 'to' not in data:
raise ValueError("No target in given data")
if 'data' not in data['to']:
raise ValueError("No data for target")