Einzelnen Beitrag anzeigen

Kostas

Registriert seit: 14. Mai 2003
Ort: Gerstrhofen
1.063 Beiträge
 
Delphi 10 Seattle Enterprise
 
#7

AW: DataSnap ein TFDJSONDataSets als TJSONObject übertragen

  Alt 25. Mär 2015, 14:03
Ich habe etwas feststellen können.
Wenn ich die Query per SaveToFile als Jason exportiere, bekomme ich ein sauberes JASON.
Der TFDJSONDataSetsWriter erzeugt ein binäres Format.

könnte hier das Problem sein?

Delphi-Quellcode:
function TdmDALZMI.GetBau(BauNr:integer): TFDJSONDataSets;
begin
  qrGetBau.Active := False;
  qrGetBau.Params[0].Value := BauNr;
  qrGetBau.Active := True;
  qrGetBau.SaveToFile('f:\JSONBau.txt',TFDStorageFormat.sfJSON); <<< String Klartext

  Result := TFDJSONDataSets.Create;
  TFDJSONDataSetsWriter.ListAdd(Result, qrGetBau);
end;


function TdmDALZMI.GetBauJSON(BauNr:integer): TJSONObject;
var
  LDataSets: TFDJSONDataSets;
  s:TStringList;
begin
  LDataSets := GetBau(BauNr);
  try
    Result := TJSONObject.Create;
    TFDJSONInterceptor.DataSetsToJSONObject(LDataSets, Result);

    s:=TStringList.Create;
    s.Text := result.ToString;
    s.SaveToFile('f:\JSON.txt'); <<<<< Binärer Inhalt
    s.Free;


  finally
    LDataSets.Free;
  end;
end;

Gruß Kostas
  Mit Zitat antworten Zitat