ok, i found WHERE is the problem, but i still do not understand WHY.
I leave the functions like in the first post, but i just ommited one thing...
function GetWebData(market):dataconfig;
var
Data: TJSONData;
DataArrayItem: TJSONData;
JSON: TJSONStringType;
I: Integer;
ObjName: String;
Resultado: dataconfig;
Begin
market:= StringReplace(market,' ','',[rfReplaceAll, rfIgnoreCase]);
JSON :=Read_URL_GET('https:myweb.com?symbol='+market);
if JSON = 'ERROR' then
Begin
Resultado.nombredata := 'ERROR';
Resultado.valordata := 'ERROR';
GetWebData:=resultado;
exit;
end;
{if not IsValidJSON(JSON) then
Begin
Resultado.nombredata := 'ERROR';Resultado.valordata := 'ERROR';GetWebData:=resultado;
exit;
end;}
Data := GetJSON(JSON);
for I := 0 to Data.Count - 1 do
begin
ObjName := TJSONObject(Data).Names[I];
if Data.Items[I].JSONType = jtArray then
begin
DataArrayItem := TJSONObject(Data.Items[I]);
if (ObjName = 'pros') then Resultado.nombredata := float_changeformat(TJSONObject(DataArrayItem.Items[0]).Items[0].Value);
if (ObjName = 'cons') then Resultado.valordata := float_changeformat(TJSONObject(DataArrayItem.Items[0]).Items[0].Value);
end;
end;
GetWebData:=resultado;
data.Free;
end;
Just skiping the call to IsValidJason all works perfect.
Ans this is the function which makes my app eat slowly all the memory.
function IsValidJSON (MyJSONstring:string):boolean;
var
Data: TJSONData;
begin
Try
Data := GetJSON(MyJSONstring);
except
On E : ejsonparser do
Begin
IsValidJSON := false;
exit;
end;
end;
IsValidJSON := true;
end;