def json_hook(obj):
 if ('$dt' in obj):
  x = obj['$dt']
  return datetime.strptime(x, '%Y-%m-%dT%H:%M:%S.%f')
 return obj

def json_hook ( obj ) : if ( '$dt' in obj ) : x = obj [ '$dt' ] return datetime . strptime ( x , '%Y-%m-%dT%H:%M:%S.%f' ) return obj
json object hook .