def check_json(json_hash): test_health_plan = HealthPlan() test_health_plan.parse_JSON(json.dumps(json_hash)) for key, value in json_hash.items(): if isinstance(value, dict): for subkey, subvalue in value.items(): check_attribute_value(test_health_plan, key + '_' + subkey, subvalue) else: check_attribute_value(test_health_plan, key, value)
def create_plan_from_hash(plan_hash): result = HealthPlan() result.parse_JSON(json.dumps(plan_hash)) return result