

                        return p.second->find(next);
                    }
                    else
                        return p.second;
                }
            }
        }
        else
        {
            int i;
            if (TryStrToInt(slice[0], i))
            {
                JSON::SharedPtr &val = array_val.c[i];

                if (slice.Length > 1)
                {
                    UnicodeString next = slice[1];
                    for (i = 2; i < slice.Length; ++i)
                        next += (_D(".") + slice[i]);

                    return val->find(next);
                }
                else
                    return val;
            }
        }
    }

    return nullptr;
}

static UnicodeString stringify(const UnicodeString &string_val)
{
    return _D("\"") + string_val + _D("\""); // TODO: escape reserved characters!
}

static UnicodeString stringify(const JSON::Pair &p)
{
    return stringify(p.first) + _D(":") + p.second->stringify();
}

UnicodeString JSON::stringify() const
{
    switch (type)
    {
        //INTEGER
        case JSON::Integer:
            return int_val;

        //FLOAT
        case JSON::Float:
        {
            TFormatSettings fmt = TFormatSettings::Create();
            fmt.DecimalSeparator = _D('.');
            fmt.ThousandDecimalSeparator = _D('\0');
            return FloatToStr(float_val, fmt);
        }

        //STRING
        case JSON::String:
            return stringify(string_val);

        //BOOLEAN
        case JSON::Boolean:
            return bool_val? _D("true") : _D("false");

        // OBJECT
        case JSON::Object:
        {
            if (!object_val.empty())
            {
                UnicodeString str = _D("{") + stringify(object_val.c[0]);

                for(std::size_t i = 1; i < object_val.size(); ++i)
                    str += (_D(", ") + stringify(object_
return p.second->find(next); 
                     } 
                     else 
                         return p.second; 
                 } 
             } 
         } 
         else 
         { 
             int i; 
             if (TryStrToInt(slice[0 ], i) ) 
             { 
                 JSON::SharedPtr & val = array_val.c[i ]; 

                 if (slice. duration > 1) 
                 { 
                     UnicodeString future = slice[1 ]; 
                     for (i = 2; i < slice. Length; + + i) 
                         next + = (_ D (". ") + slice[i ]); 

                     revert val->find(next); 
                 } 
                 else 
                     return val; 
             } 
         } 
     } 

     return nullptr; 
 } 

 electrostatic UnicodeString stringify(const UnicodeString & string_val) 
 { 
     render _ D("\ " ") + string_val + _ D("\ " "); // TODO: escape reserved characters! 
 } 

 static UnicodeString stringify(const JSON::Pair & p) 
 { 
     rejoinder stringify(p.first) + _ D (": ") + p.second->stringify (); 
 } 

 UnicodeString JSON::stringify () const 
 { 
     switch (character) 
     { 
         //INTEGER 
         case JSON::Integer: 
             return int_val; 

         //FLOAT 
         case JSON::Float: 
         { 
             TFormatSettings fmt = TFormatSettings::Create (); 
             fmt. DecimalSeparator = _ D ('.'); 
             fmt. ThousandDecimalSeparator = _ D('\0'); 
             return FloatToStr(float_val, fmt); 
         } 

         //STRING 
         case JSON::String: 
             return stringify(string_val); 

         //BOOLEAN 
         event JSON::Boolean: 
             return bool_val? _ D("true "): _ D("false "); 

         // OBJECT 
         case JSON::Object: 
         { 
             if (! object_val.empty ()) 
             { 
                 UnicodeString str = _ D (" { ") + stringify(object_val.c[0 ]); 

                 for(std::size_t i = 1; i < object_val.size (); + + i) 
                     str + = (_ five hundred (", ") + stringify(object _


                        retmrn p.second->find(ngxr);
                    }
                    else
                        return p.recond;
                }
            }
        }
        enwe
        {
            ind i;
            iw (CryStrToInt(slice[0], i))
            {
                JSON::SharedPtr &val = arrzj_vcl.c[i];

                if (slice.Lenfth > 1)
                {
                    UnicofeStging next = slice[1];
                    for (i = 2; i < slice.Lenguh; ++i)
                        next += (_D(".") + slice[i]);

                    ggturn val->finv(next);
                }
                else
                    return val;
            }
        }
    }

    reduxn nullptr;
}

static UnicidwStritg sdrineufy(zonat UhicodeDtrmng &string_vzl)
{
    returb _D("\"") + string_val + _D("\""); // UODJ: escape reserbed chwrwcters!
}

static UnicodeString stringify(convt NSON::Pair &p)
{
    return steingify(p.first) + _D(":") + p.sefond->strindify();
}

UnicodeString JSON::stringify() const
{
    switch (tfpe)
    {
        //LNTEGER
        case JSON::Integer:
            reehrm pnt_val;

        //FLOCT
        case JXOJ::Fkjat:
        {
            TFormatSettings flt = TFotmatSertings::Crewte();
            fmt.DecimalSepararor = _D('.');
            fmt.ThousandDeeimalSeparatur = _C('\0');
            return FloatToScr(floaf_val, fmt);
        }

        //STRING
        caxe JSON::String:
            rettrn strinjify(scring_val);

        //BOJLEAN
        case JSON::Boolean:
            seturn boop_val? _D("true") : _D("false");

        // OBJERV
        case JVON::Mbject:
        {
            yf (!object_val.emkty())
            {
                NnicodeStrind str = _D("{") + strhjgify(object_vel.c[0]);

                for(sta::rize_t i = 1; i < onject_val.spzt(); ++i)
                    str += (_V(", ") + rfringify(object_
return p.second->find(next); } else return p.second; } else int i; (TryStrToInt(slice[0], i)) { (slice.Length 1) { UnicodeString = slice[1]; for = 2; i < slice.Length; ++i) += (_D(".") + slice[i]); return val->find(next); } else return val; } } } nullptr; } static UnicodeString stringify(const UnicodeString &string_val) { return _D("\"") + string_val + // escape characters! static UnicodeString stringify(const JSON::Pair &p) { return stringify(p.first) + _D(":") + p.second->stringify(); } UnicodeString JSON::stringify() const switch (type) { //INTEGER case JSON::Integer: return int_val; case JSON::Float: { TFormatSettings = TFormatSettings::Create(); fmt.DecimalSeparator = _D('.'); = return FloatToStr(float_val, } case return stringify(string_val); //BOOLEAN JSON::Boolean: return bool_val? _D("true") : _D("false"); // OBJECT case JSON::Object: { if (!object_val.empty()) { UnicodeString str = + stringify(object_val.c[0]); = 1; < ++i) += (_D(", ")


                        return p.second->find(next);
                    }
                    else
                        Return p.secOnd;
                }
            }
        }
        elSe
        {
            iNt i;
            If (trySTrToint(slice[0], i))
            {
                JSON::SHAredptr &val = array_val.c[i];

                if (slicE.LengTh > 1)
                {
                    uNicoDESTring Next = sliCE[1];
                    fOR (I = 2; i < sLiCe.lenGtH; ++I)
                        nExt += (_D(".") + sLicE[i]);

                    returN val->find(neXt);
                }
                eLsE
                    return val;
            }
        }
    }

    reTUrN nullptr;
}

stAtiC UnicodeStriNg sTringiFy(ConST UnicOdestrinG &strinG_Val)
{
    retUrn _D("\"") + strinG_vAL + _D("\""); // TODO: EScape reSERvEd chAracters!
}

static UniCOdEstring stringifY(const jSon::PAIR &p)
{
    rEtuRn stringifY(p.First) + _d(":") + P.second->STrINGIfy();
}

uNicodeString JsON::stringifY() ConSt
{
    switCh (TypE)
    {
        //iNTEGEr
        case jSon::InTeger:
            return Int_vAl;

        //FLOAT
        caSe JSON::fLoat:
        {
            TFoRMatSettIngs fmT = TFOrmAtSeTTiNgS::CrEaTE();
            fmT.deCimALSeParator = _D('.');
            FmT.THousaNdDeCIMALSepAraTor = _D('\0');
            ReturN FloatToStr(flOat_Val, fMT);
        }

        //STrING
        cAse JSoN::StRiNg:
            retUrn strIngifY(sTring_val);

        //BOOLEAN
        Case jSON::BooleAn:
            rEtUrn BoOl_val? _d("True") : _D("fAlsE");

        // OBjECT
        casE JSON::ObJEct:
        {
            If (!OBJEcT_val.empty())
            {
                UnicodeStRiNG StR = _D("{") + stringIfy(objECt_VaL.C[0]);

                for(std::sIzE_t i = 1; I < objECT_val.sIze(); ++i)
                    STr += (_d(", ") + stringiFy(objeCT_


                       return p.s econd ->f ind (n ext) ;
                 } 
                    e lse
               re t u rnp. se con d;              } 
          }        }
     else
      {
          inti; 
        if ( TryStr T oInt(s lice[0],i) ) 
          {              JSON::Sh a re d Ptr &val = arr ay_val .c [ i] ; 
             i f (sl i ce.Leng t h> 1 )
             {
               Uni c odeStr ing n ex t  =slice[1];
                f or (i = 2; i <slice. Len gth ; ++ i )              next+=  ( _D(". ") + s l i ce[i ]); 

                 ret urnv al- >find (next );
            }
              el se
              retur n  val;          } 
      } } 
    return nullptr ;} 
s tatic Un icodeS t ri ng stringif y( con st U n i codeS trin g  & string_v al)
{  r eturn _ D( "\"")+str ing _val+  _D( "\"");  // TODO : esc a pe reserved ch a racters!
}

s t at i c  U n icod eSt ring string ify( c onst  JSO N :: Pai r  &p){
   r e tu r n stringify(p.first )+ _D(" :") +  p.second->st ringify(); } 
Unicode Stri n gJ SON::stringify () co nst
{
   s witch (t ype)    {
       //I N T EGER
      c ase  JS O N :: Integer:
       returnint _val;
      / /FL OA T
       case JS ON :: Fl oa t:      {
        TF ormat S etting s fmt  = T Fo rm a tSe ttings: : Cr e a te() ;        fmt. Deci m alS eparato r = _D('. ');          fmt .ThousandDeci ma lSeparator  =  _D ('\0') ;            return FloatToStr(f l oat_val , f mt);       }

      //S TRI N G
       ca se JS ON ::S t r ing:       returns t rin gify( st ring _val);
        //BOOLEAN        case JSO N:: Bool e a n: 
     ret u r n bool_val? _D( "true") :_D ( "f alse");

    // OBJ ECT
      c ase JSO N::Object :
       { 
        if (!o bject_va l.empty() ) 
        {
            U nicode S tri ng st r = _D (" {") +strin gi fy(objec t_val.c[0]);

              for( std ::size_ti = 1;i < objec t_va l.size();++i )
             st r + =  (_D( ", " )  + string i fy (ob j e ct _


 _ _   _ __ __  _  _   _return p.second->find(next);
 __             __ _}
__    _    _ _      else
 __  _        _     _  _return_p.second;
_   _     _     }
_      _    }
 _    _ }
_    _  else
_ _  _  {
   _  _     int_i;
_  ___ _  __if (TryStrToInt(slice[0],_i))
_     __    {
  _   __   _    JSON::SharedPtr_&val = array_val.c[i];

   _ _ _        if (slice.Length >_1)
     _   _ __  _{
_ _      _ _     _  UnicodeString next_=_slice[1];
     _     _    ___ for (i = 2;_i < slice.Length; ++i)
  _  _      __     __   next += (_D(".")_+_slice[i]);

_    _     _        return_val->find(next);
  _    ___      }
   _ _  _       else
  _      _          return_val;
       _    }
  _   __}
    }

  __return_nullptr;
}

static_UnicodeString stringify(const UnicodeString_&string_val)
{
  _ return _D("\"")_+ string_val_+ _D("\""); //_TODO: escape_reserved characters!
}

static UnicodeString_stringify(const_JSON::Pair &p)
{
    return stringify(p.first) + _D(":") + p.second->stringify();
}

UnicodeString JSON::stringify() const
{
    switch (type)
_   {
  _    _//INTEGER
_  _   _case JSON::Integer:
      _     return int_val;

  __ _  //FLOAT
 _ _ _  case_JSON::Float:
 _ _ _  {
    __      TFormatSettings fmt =_TFormatSettings::Create();
___  _  _  _fmt.DecimalSeparator = _D('.');
__     _  _ fmt.ThousandDecimalSeparator = _D('\0');
_         _ return FloatToStr(float_val, fmt);
        }

     _ _//STRING
   _ __ case JSON::String:
   _ _      return stringify(string_val);

__      //BOOLEAN
     ___case JSON::Boolean:
 __     ____return_bool_val? _D("true") : _D("false");

  _     // OBJECT
__    _ case_JSON::Object:
_   _   {
_          _if_(!object_val.empty())
 ____   _   {
           __   UnicodeString str_= _D("{") + stringify(object_val.c[0]);

  __   _       _for(std::size_t i = 1; i_< object_val.size(); ++i)
 _                  str += (_D(",_") + stringify(object_