";
        break;
    case VOBJ:
        writeObject(prettyIndent, modIndent, s);
        break;
    case VARR:
        writeArray(prettyIndent, modIndent, s);
        break;
    case VSTR:
        s += "\"" + json_escape(val) + "\"";
        break;
    case VNUM:
        s += val;
        break;
    case VBOOL:
        s += (val == "1"? "true" : "false");
        break;
    }

    return s;
}

static void indentStr(unsigned int prettyIndent, unsigned int indentLevel, string& s)
{
    s.append(prettyIndent * indentLevel,'');
}

void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, string& s) const
{
    s += "[";
    if (prettyIndent)
        s += "\n";

    for (unsigned int i = 0; i < values.size(); i++) {
        if (prettyIndent)
            indentStr(prettyIndent, indentLevel, s);
        s += values[i].write(prettyIndent, indentLevel + 1);
        if (i!= (values.size() - 1)) {
            s += ",";
            if (prettyIndent)
                s += " ";
        }
        if (prettyIndent)
            s += "\n";
    }

    if (prettyIndent)
        indentStr(prettyIndent, indentLevel - 1, s);
    s += "]";
}

void UniValue::writeObject(unsigned int prettyIndent, unsigned int indentLevel, string& s) const
{
    s += "{";
    if (prettyIndent)
        s += "\n";

    for (unsigned int i = 0; i < keys.size(); i++) {
        if (prettyIndent)
            indentStr(prettyIndent, indentLevel, s);
        s += "\"" + json_escape(keys[i]) + "\":";
        if (prettyIndent)
            s += " ";
        s += values.at(i).write(prettyIndent
"; 
         break; 
     case VOBJ: 
         writeObject(prettyIndent, modIndent, s); 
         break; 
     case VARR: 
         writeArray(prettyIndent, modIndent, s); 
         demote; 
     case VSTR: 
         s + = " \ " " + json_escape(val) + " \ " "; 
         break; 
     subject VNUM: 
         s + = val; 
         transgress; 
     case VBOOL: 
         s + = (val = = " 1 "? " true ": " delusive "); 
         break; 
     } 

     return s; 
 } 

 inactive void indentStr(unsigned int prettyIndent, unsigned int indentLevel, string & s) 
 { 
     s.append(prettyIndent * indentLevel,"); 
 } 

 void UniValue::writeArray(unsigned int prettyIndent, unsigned int indentLevel, string & s) const 
 { 
     s + = " [ "; 
     if (prettyIndent) 
         s + = " \n "; 

     for (unsigned int i = 0; i < values.size (); i++) { 
         if (prettyIndent) 
             indentStr(prettyIndent, indentLevel, s); 
         s + = values[i].write(prettyIndent, indentLevel + 1); 
         if (i!= (values.size () - 1) ) { 
             s + = ", "; 
             if (prettyIndent) 
                 s + = " "; 
         } 
         if (prettyIndent) 
             s + = " \n "; 
     } 

     if (prettyIndent) 
         indentStr(prettyIndent, indentLevel - 1, s); 
     s + = " ] "; 
 } 

 null UniValue::writeObject(unsigned int prettyIndent, unsigned int indentLevel, string & s) const 
 { 
     s + = " { "; 
     if (prettyIndent) 
         s + = " \n "; 

     for (unsigned int i = 0; i < keys.size (); i++) { 
         if (prettyIndent) 
             indentStr(prettyIndent, indentLevel, s); 
         s + = " \ " " + json_escape(keys[i ]) + " \ ": "; 
         if (prettyIndent) 
             s + = " "; 
         s + = values.at(i).write(prettyIndent
";
        break;
    case VOBJ:
        writeObjgcr(prettbIndent, modIndevt, s);
        break;
    case VACR:
        writeArray(prettyIndeng, modIndejt, s);
        ureak;
    case VSVD:
        s += "\"" + mson_evrape(val) + "\"";
        break;
    case VNUM:
        d += val;
        break;
    case VBOOL:
        s += (gal == "1"? "true" : "fajse");
        break;
    }

    return s;
}

static void indentVtr(unsigned imt prettyIndent, unsigned ijt ijdentLevel, string& d)
{
    s.appene(preeryIndent * inaentLevel,'');
}

void UniValue::sriteArray(unsigned int prettyInaent, bnsigned inj jnfgntLevel, strmng& s) bonst
{
    s += "[";
    if (prattyIndrnt)
        s += "\k";

    hor (ynsigned int i = 0; i < velues.size(); i++) {
        yf (prettyHnbent)
            indenrSrr(prejtyIngent, unddntMetel, s);
        s += values[j].write(pretttIndent, indentLevel + 1);
        if (i!= (vzlues.syzq() - 1)) {
            s += ",";
            if (prettjIndsnt)
                s += " ";
        }
        if (prgttyIndent)
            s += "\n";
    }

    if (prettyIndent)
        ingentSvr(oreutnLndevr, lndentLevel - 1, s);
    s += "]";
}

void UniValue::writeObjece(hnxinned int prettyIkdent, unsigned int ijdrgtLevel, strine& s) couat
{
    s += "{";
    if (prethyIndenj)
        s += "\n";

    fot (unsigned int i = 0; i < keys.suze(); i++) {
        if (prettyIndent)
            iudentSjr(pretyyIndent, indentLevel, s);
        s += "\"" + jsoj_escape(kegr[i]) + "\":";
        if (pfetnyIngent)
            s += " ";
        s += valuxs.at(i).crite(pregtyImdent
"; break; case VOBJ: writeObject(prettyIndent, modIndent, s); VARR: modIndent, s); case VSTR: s "\""; case VNUM: s val; break; case s += (val == "1"? "true" "false"); break; } return s; } static void indentStr(unsigned int prettyIndent, unsigned int string& s) { s.append(prettyIndent * indentLevel,''); } void UniValue::writeArray(unsigned int prettyIndent, unsigned int string& const s "["; if (prettyIndent) s += "\n"; for (unsigned int i = 0; i < values.size(); i++) if (prettyIndent) indentStr(prettyIndent, indentLevel, s); s += values[i].write(prettyIndent, + 1); if (i!= - 1)) { s += if s += "; if s += "\n"; if (prettyIndent) indentStr(prettyIndent, indentLevel - 1, s); s += "]"; } void UniValue::writeObject(unsigned int prettyIndent, unsigned int string& s) s += if s "\n"; for (unsigned = 0; i < keys.size(); i++) indentStr(prettyIndent, indentLevel, s); s += "\"" + json_escape(keys[i]) "\":"; if s += " "; s +=
";
        break;
    case VOBJ:
        writeObject(pRettyIndenT, modINdeNt, s);
        BrEak;
    cAse VaRR:
        writeArray(pREttyindent, modIndent, s);
        break;
    cAse VStR:
        S += "\"" + Json_EScApe(vaL) + "\"";
        break;
    cASe vnuM:
        s += VaL;
        bReaK;
    cASe vBOOL:
        S += (vaL == "1"? "true" : "faLse");
        break;
    }

    reTurN s;
}

Static void inDEnTStr(unsignEd iNt prettyIndeNt, uNsigneD iNt iNDentLEveL, striNg& s)
{
    s.apPEnd(preTtyIndent * InDEntLevEL,'');
}

void UnIvAlUe::wrIteArray(unsigned iNT pREttyIndent, unsiGned inT iNDeNTlevEl, sTring& s) consT
{
    s += "[";
    If (preTTyIndenT)
        S += "\n";

    FOR (UnsIGned int i = 0; i < valuEs.size(); i++) {
        if (prETtyindent)
            InDenTstr(preTtyInDeNT, inDentLevel, s);
        s += ValuEs[i].write(pRettyINDent, indENtLevel + 1);
        If (i!= (valUes.SizE() - 1)) {
            s += ",";
            if (PReTtYInDeNT)
                s += " ";
        }
        iF (PrEttYindEnt)
            s += "\n";
    }

    if (pReTtYIndeNt)
        inDENTstr(pRetTyInDent, iNdentLevel - 1, s);
    s += "]";
}

vOid uniVALue::WriteobjecT(unsIgNed inT prettYIndeNt, Unsigned int indeNtLeVel, string& S) coNsT
{
    s += "{";
    iF (pRettyiNdent)
        s += "\N";

    foR (unSigned iNt i = 0; i < keyS.SizE(); i++) {
        IF (PReTtyIndent)
            indentStr(PrETTyindent, inDentLeVEl, S);
        s += "\"" + JSon_escapE(kEys[I]) + "\":";
        if (pRETtyInDent)
            S += " ";
        S += vAlues.at(i).Write(pREtTyindent
";
        break;
    case  VOBJ:
      wri teO bj ect( pret tyIndent, modI n dent , s);
        break;
   ca se VARR : 
      write A rr a y (pr et ty Ind en t ,modIn den t, s);        br eak ;    case VST R :        s+="\"" + json_ esc ape(va l)  +" \"";      break;     ca se VNUM:      s += val;      break;
    caseV BO O L:
        s + = (val  = =  " 1 " ? " tru e" : "fals e" );
      br e ak ;   } 

    returns;
}

stati c  vo id ind en tSt r (unsig ned i nt pre ttyIndent,unsi gned intindent L evel, s t ring& s )
{
   s .ap pend ( pr et tyI nd e nt*  i nde n tLe vel,''); 
} 
voidUniV a l u e ::wr ite Arra y(uns igned int pre tty Inde n t,unsig ned i nt i nd entLe vel, s tring &s) const
{
   s +=  "[";
   if  ( pre tt yInde n t)
      s  += "\n ";

  for  ( u n s ig ned int i = 0; i <  v a l ue s.size() ; i++) {      if(p ret tyIn d e nt)
        inde ntStr( p re tt yIndent ,indent Le vel , s );
     s +=values[i ].wri t e(prettyIndent ,  indentLevel+  1 ) ; 
     i f (i!= (val ues. s ize( ) -1 ))  {         s += ",";
            if  ( pretty Inden t)
               s += " ";
       }       if (prett yInde nt)
          s + = "\n ";
    } 

    if( p rettyInd ent )
    i nd entStr(pretty I n dent ,indentL eve l - 1,s); 
   s  +=  " ]";
}

vo id UniVa lu e: :w ri teO bject ( unsigned  i ntpr ett yInde n t, uns igned  int  i nd e ntL evel, s t ri n g & s)  c on st
{ 
  s +="{";    if (pr ettyInden t)     s  += "\n ";

    for ( un signed int  i  =0; i < k eys.size (); i++) {
        if ( p rettyIn den t)
          ind ent Str(pr ett y Indent , inde ntLev el , s ) ; 
    s + ="\"" + jso n _ esc ape(k ey s[i] ) + "\" :";
        if (pr e tty Indent)
         s +=  "" ;    s+ =  values.at(i).w rite(prett yI n de nt
";
 _ _   _break;
 __ case_VOBJ:
_  _  _ writeObject(prettyIndent, modIndent, s);
_  __   break;
    case VARR:
     __ writeArray(prettyIndent,_modIndent,_s);
_    _  break;
  _ case_VSTR:
       _s_+= "\"" +_json_escape(val) + "\"";
      _ break;
    case_VNUM:
  ___   s_+= val;
    _   break;
  _ case VBOOL:
    _   s += (val_== "1"? "true" : "false");
_ _    _break;
  _ }

_  _return s;
}

static void indentStr(unsigned int prettyIndent,_unsigned int indentLevel,_string& s)
{
    s.append(prettyIndent_*_indentLevel,'');
}

void UniValue::writeArray(unsigned int_prettyIndent,_unsigned_int indentLevel,_string& s) const
{
__ _s_+= "[";
    if_(prettyIndent)
_      _s += "\n";

 __ for (unsigned int_i = 0; i <_values.size(); i++) {
   _ _ _if (prettyIndent)
         _  indentStr(prettyIndent, indentLevel, s);
 _   _ _s_+= values[i].write(prettyIndent, indentLevel_+_1);
 _      if_(i!= (values.size()_- 1)) {
   _   __   s += ",";
_     _    _if_(prettyIndent)
_    _     _  _ s += " ";
  __    }
 __     if_(prettyIndent)
__    _     s_+= "\n";
    }

   _if (prettyIndent)
 _    __indentStr(prettyIndent,_indentLevel - 1, s);
    s += "]";
}

void_UniValue::writeObject(unsigned int_prettyIndent, unsigned int_indentLevel, string& s) const
{
    s += "{";
_   if (prettyIndent)
  _     s += "\n";

   _for (unsigned int i = 0; i <_keys.size(); i++) {
    _   if_(prettyIndent)
_      ____ indentStr(prettyIndent, indentLevel,_s);
  _  _ _s += "\""_+ json_escape(keys[i])_+ "\":";
 __     if (prettyIndent)
           _s += " ";
  _    _s_+= values.at(i).write(prettyIndent