Libraries: JSON Parser - page 5

 

tired of 36 warnings (I do not mind of them, but of course it becomes possible to miss something really important).

I mean this kind of warnings "deprecated behavior, hidden method calling will be disabled in a future MQL compiler version json.mqh 542 20

Attached version does not have such problem. Thank you guys, you made a great code!



Files:
json.mqh  50 kb
 
Daniel Lagoshniak:

tired of 36 warnings (I do not mind of them, but of course it becomes possible to miss something really important).

I mean this kind of warnings "deprecated behavior, hidden method calling will be disabled in a future MQL compiler version json.mqh 542 20

Attached version does not have such problem. Thank you guys, you made a great code!



You made your changes not from my latest version of json.mqh, but from an older version.

Do you use the libraries with MQL4 or MQL5 ? They are made for MQL4 and I have never tested them on MQL5.

I use MT4 build 1260 and MetaEditor version 5.00 build 2302 from 24. Jan 2020. I do not get any warnings when compiling my

latest version of json.mqh with MQL4.

 

hi 

your link for document is invalid 

can you give the address for your document

thank you 

 
Daniel Lagoshniak :

cansado de 36 avisos (não me importo com eles, mas é claro que torna-se possível perder algo importante).

Quero dizer, esse tipo de aviso " comportamento obsoleto, chamado de método oculto será desabilitada em uma versão futura do compilador MQL json.mqh 542 20

A versão em anexo não tem esse problema. Obrigado pessoal, vocês fizeram um ótimo código!



Just by :: before the functions that have a problem with the hidden method call

 

Hi, I have this peace of code that is working but there are warnings that I can't fix. Can anyone help me?

        bool VerificarLicenca2() 
  {
    string s = resposta;

    JSONParser *parser = new JSONParser();
    JSONValue *jv = parser.parse(s);
    if (jv == NULL) {
        Print("[ERRO]: "+(string)parser.getErrorCode()+parser.getErrorMessage());
    } 
    else 
     {
        //Print("PARSED: "+jv.toString());
        if (jv.isObject()) 
         {
            JSONObject *jo = jv;
            
            string status = ""; 
            string dateCompletedAPI="";
            datetime dateCompleted=D'1990.01.01'; 
            jo.getString("date_completed", dateCompletedAPI);
            if (dateCompletedAPI != "") 
             {
               dateCompleted = StringToTime(dateCompletedAPI);
               Print("date_completed:" + TimeToString(dateCompleted));
             }
            //string apiUser = "35481650";
            string apiUser; 
            
            //FUNCIONANDO POREM COM WARNING           
            JSONArray metadata = jo.getArray("meta_data");
            for(int i=0;i<metadata.size();i++)
              {
               string tempKey = "";
               //Print(metadata.getObject(i).toString());
               metadata.getObject(i).getString("key", tempKey);
               if(tempKey=="additional_login_corretora")
                 {
                  metadata.getObject(i).getString("value", apiUser);
                 }
              }
            
            if(StringToInteger(apiUser)!=currentUser) 
             {
              //Print("Licença de " +product_id+" - "+ " não permitida para o login: "+IntegerToString(currentUser));
              Print("[ERRO]: Licença não permitida para o login: "+IntegerToString(currentUser));
             } 
            else
             {
//                 if(StringToInteger(product_id)==productIdProducao) //verifica se é o produto correto 
//                   {
                       dataVencimento = dateCompleted + 2592001;
                       if(TimeCurrent()<=dataVencimento) //verifica se o período da assinatura está válida
                         {
                          Print("Pedido: "+IntegerToString(numero_pedido)+". Data da assinatura: "+TimeToString(dateCompleted, TIME_DATE));
                          Print("PARABÉNS!!! Licença permitida para o login: "+IntegerToString(currentUser)+" até o dia: "+TimeToString(dataVencimento, TIME_DATE));
                          return true;
                         }
                       else
                         {
                          Print("[ERRO]: Licença vencida em "+TimeToString(dataVencimento));
                          return false;
                         }
//                   }
//                 else
//                   {
//                     Print("[ERRO]: Licença não permitida para esse tipo de produto.");
//                     return false;
//                   }
             }
        }
        delete jv;
    }
    delete parser;
    
    return false;
  } 


Json Problem


Warning

 

dear ydrol

would you please provide the code to parse this json url?

https://search.codal.ir/api/search/v2/q?&Audited=true&AuditorRef=-1&Category=-1&Childs=true&CompanyState=-1&CompanyType=-1&Consolidatable=true&IsNotAudited=false&Length=-1&LetterType=-1&Mains=true&NotAudited=true&NotConsolidatable=true&PageNumber=1&Publisher=false&TracingNo=-1&search=true
 
Thank you for a great product! It works well while there is not enough data, but if the array is more than 1000 rows, an error appears. Please tell me how to fix it.
 
There is an issue, you don't set type number for class JSONNumber. Please update JSONNumber(long l) { _long = l; _dbl = 0; setType(JSON_NUMBER); } JSONNumber(double d) { _long = 0; _dbl = d; setType(JSON_NUMBER); }
Reason: