Diff for /parser3/src/classes/json.C between versions 1.59 and 1.62

version 1.59, 2024/09/10 19:09:56 version 1.62, 2024/10/02 19:34:04
Line 10 Line 10
   
 #include "pa_request.h"  #include "pa_request.h"
 #include "pa_vbool.h"  #include "pa_vbool.h"
 //#include "pa_varray.h"  #include "pa_varray.h"
   
 #include "pa_charset.h"  #include "pa_charset.h"
 #include "pa_charsets.h"  #include "pa_charsets.h"
Line 93  static void set_json_value(Json *json, V Line 93  static void set_json_value(Json *json, V
                                 if (top->hash().put_dont_replace(*json->key, value)){                                  if (top->hash().put_dont_replace(*json->key, value)){
                                         for(int i=2;;i++){                                          for(int i=2;;i++){
                                                 String key;                                                  String key;
                                                 key << *json->key << "_" << format(i, 0);                                                  key << *json->key << "_" << pa_uitoa(i);
                                                 if (!top->hash().put_dont_replace(key, value)) break;                                                  if (!top->hash().put_dont_replace(key, value)) break;
                                         }                                          }
                                 }                                  }
Line 153  static int json_callback(Json *json, int Line 153  static int json_callback(Json *json, int
                                 json->key=NULL;                                  json->key=NULL;
                                 json->stack.push(new VHash);                                  json->stack.push(new VHash);
                         } else {                          } 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);                                  if (json->stack.count()) set_json_value(json, v);
                                 json->stack.push(v);                                  json->stack.push(v);
                         }                          }
Line 651  static void _string(Request& r, MethodPa Line 650  static void _string(Request& r, MethodPa
                                 throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION);                                  throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION);
   
                         // special handling for $._default                           // special handling for $._default 
                         if(VHashBase* vhash=static_cast<VHashBase*>(params[1].as(VHASH_TYPE)))                          if(VHashBase* vhash=dynamic_cast<VHashBase*>(&params[1]))
                                 if(Value* value=vhash->get_default()) {                                  if(Value* value=vhash->get_default()) {
                                         if(!value->is_string()){                                          if(!value->is_string()){
                                                 Junction* junction=value->get_junction();                                                  Junction* junction=value->get_junction();

Removed from v.1.59  
changed lines
  Added in v.1.62


E-mail: