Delphi Can
JSonToObject TBytes - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Genel Programlama (https://www.delphican.com/forumdisplay.php?fid=6)
+--- Konu Başlığı: JSonToObject TBytes (/showthread.php?tid=740)



JSonToObject TBytes - edo - 07-03-2017

Merhaba,

Aşağıdaki class tanımı için ilgili kodu çalıştırdığımda TBytes tipinden dolayı 
Internal: Value 77u/bcSxDQoNCmYgb3BJdSkgVGHFn8.......gVEwuDQpURVNMxLBNIEFMQU4= cannot be converted to be assigned to field Result in type TProcessTextImageResult.
şeklinde bir hata alıyorum. Result property'sinin tipini string yaparsam elime String tipinde bir bytes dizisi geçiyor onu da çözümleyemedim. 

Konu ile ilgili fikri olan var mı acaba  Rolleyes

TJson.JsonToObject<TProcessTextImageResult>(MemoContent.Lines.Text);

    TProcessTextImageResult = class
    private
       FSuspiciousSymbolsCount: Integer;
        FUnrecognizedSymbolsCount: Integer;
        FAllSymbolsCount: Integer;
        FAllWordsCount: Integer;
        FNotDictionaryWordsCount: Integer;
        FResult: TBytes;
    published
        property SuspiciousSymbolsCount: Integer read FSuspiciousSymbolsCount write FSuspiciousSymbolsCount;
        property UnrecognizedSymbolsCount: Integer read FUnrecognizedSymbolsCount write FUnrecognizedSymbolsCount;
        property AllSymbolsCount: Integer read FAllSymbolsCount write FAllSymbolsCount;
        property AllWordsCount: Integer read FAllWordsCount write FAllWordsCount;
        property NotDictionaryWordsCount: Integer read FNotDictionaryWordsCount write FNotDictionaryWordsCount;
        property Result: TBytes read FResult write FResult;
     end;



JSonToObject TBytes - edo - 08-03-2017

TNetEncoding.Base64.DecodeStringToBytes ile aslında bytes değer içeren string tipindeki veriyi TBytes tipine çevirdim.  TEncoding.UTF8.GetString ile de elimdeki TBytes tipindeki verinin gerçek haline eriştim. Böyle bir sorun yaşayan olursa bilgisine.