From 8ebe610e33719fc7fba4850f6cd10b23add7a36e Mon Sep 17 00:00:00 2001 From: Mahbub Alam Date: Fri, 6 Oct 2023 22:35:38 -0400 Subject: [PATCH] Convert json bool and null to python Bool and None --- 3rd/cjson/include/cjson.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/3rd/cjson/include/cjson.hpp b/3rd/cjson/include/cjson.hpp index 189c00e8..422ed7d0 100644 --- a/3rd/cjson/include/cjson.hpp +++ b/3rd/cjson/include/cjson.hpp @@ -54,10 +54,10 @@ static Dict convert_cjson_to_dict(const cJSON * const item, VM* vm) output.set(VAR(Str(child->string)), VAR(child_value->valueint)); } else if (cJSON_IsBool(child_value)){ - output.set(VAR(Str(child->string)), VAR(child_value->valueint == 0?false:true)); + output.set(VAR(Str(child->string)), child_value->valueint!=0 ? vm->True : vm->False); } else if (cJSON_IsNull(child_value)){ - output.set(VAR(Str(child->string)), VAR(vm->None)); //Todo: Covert to python None + output.set(VAR(Str(child->string)), vm->None); } else if (cJSON_IsArray(child_value)){ cJSON *array_child = child_value->child; @@ -70,10 +70,10 @@ static Dict convert_cjson_to_dict(const cJSON * const item, VM* vm) list.push_back(VAR(array_child->valueint)); } else if (cJSON_IsBool(array_child)){ - list.push_back(VAR(array_child->valueint == 0?false:true)); + list.push_back(child_value->valueint!=0 ? vm->True : vm->False); } else if (cJSON_IsNull(array_child)){ - list.push_back(VAR(vm->None)); + list.push_back(vm->None); } array_child = array_child->next; }