--- parser3/src/classes/json.C 2024/09/10 19:09:56 1.59 +++ parser3/src/classes/json.C 2024/10/02 19:34:04 1.62 @@ -10,7 +10,7 @@ #include "pa_request.h" #include "pa_vbool.h" -//#include "pa_varray.h" +#include "pa_varray.h" #include "pa_charset.h" #include "pa_charsets.h" @@ -20,7 +20,7 @@ #include "pa_vxdoc.h" #endif -volatile const char * IDENT_JSON_C="$Id: json.C,v 1.59 2024/09/10 19:09:56 moko Exp $"; +volatile const char * IDENT_JSON_C="$Id: json.C,v 1.62 2024/10/02 19:34:04 moko Exp $"; // class @@ -93,7 +93,7 @@ static void set_json_value(Json *json, V if (top->hash().put_dont_replace(*json->key, value)){ for(int i=2;;i++){ String key; - key << *json->key << "_" << format(i, 0); + key << *json->key << "_" << pa_uitoa(i); if (!top->hash().put_dont_replace(key, value)) break; } } @@ -153,8 +153,7 @@ static int json_callback(Json *json, int json->key=NULL; json->stack.push(new VHash); } else { - VHashBase *v = new VHash; -// VHashBase *v = json->handle_array ? (VHashBase *)new VArray : (VHashBase *)new VHash; + VHashBase *v = json->handle_array ? (VHashBase *)new VArray : (VHashBase *)new VHash; if (json->stack.count()) set_json_value(json, v); json->stack.push(v); } @@ -651,7 +650,7 @@ static void _string(Request& r, MethodPa throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); // special handling for $._default - if(VHashBase* vhash=static_cast(params[1].as(VHASH_TYPE))) + if(VHashBase* vhash=dynamic_cast(¶ms[1])) if(Value* value=vhash->get_default()) { if(!value->is_string()){ Junction* junction=value->get_junction();