Hmm, Nein das funktioniert leider auch (noch) nicht.
ich poste hier nochmal meinen aktuellen Code
Delphi-Quellcode:
procedure TForm1.BtnACloudClick(Sender: TObject);
Var
iDHTTP: TIdHttp;
aBody, JSON_Response: String;
aStr, aUsername,aPassword : String;
JSON: ISuperObject;
PosSTR:String;
Pos1: Integer;
begin
aUsername := 'MyUsername';
aPassword := 'MyPassword';
IdHttp := TIdHttp.Create(nil);
iDHTTP.HandleRedirects := True;
iDHTTP.Request.BasicAuthentication := True;
iDHTTP.Request.Authentication := TIdBasicAuthentication.Create;
iDHTTP.Request.Authentication.Username := aUsername;
iDHTTP.Request.Authentication.Password := aPassword;
IdHTTP.Request.ContentType := 'application/json';
aBody := 'http://test.acalc.de/tanks/changed.json?date=1970-01-01 00:00:00';
JSON_Response := IdHttp.Get(aBody);
//ClipBoard.AsText := JSON_Response;
//Cut Off first JSON String which is returned but not needed
PosSTR := '},'; //look for this characters (it is the end of the unneeded first JSON String)
Pos1 := POS(PosSTR ,JSON_Response);
Delete(JSON_Response,1,Pos1+ length(PosSTR) -1);
//ClipBoard.AsText := JSON_Response;
//Delete ']' (which is crap) at the end
Delete(JSON_Response,Length(JSON_Response),1);
//ClipBoard.AsText := JSON_Response;
JSON := SO(JSON_Response);
aStr := JSON.AsObject.S['Tank.aktCa'];
IdHTTP.Free;
end;
hier nochmal der kpl. String welcher hier
JSON := SO(JSON_Response);
"übergeben" wird
{"Tank":{"id":"B0DB7A37-9086-43B0-8468-C54908121150-142-00000000EE6AB2C4","aktAlk":"750","aktCa":"450","ak tMg":"1335","aktSal":"3478","caAlkMgAusgleichDosie rungAlk":"1.00","caAlkMgAusgleichDosierungCal":"1. 00","caAlkMgAusgleichDosierungMg":"1.00","caAlkMgA usgleichDosierungNaClSalz":"1.00","caAlkMgVerbrauc hAlkAusg":"7.00","caAlkMgVerbrauchAlkEndwert":"7.2 0","caAlkMgVerbrauchAlkTage":"7","caAlkMgVerbrauch CaAusg":"400","caAlkMgVerbrauchCaEndwert":"375","c aAlkMgVerbrauchCaTage":"7","caAlkMgVerbrauchMgAusg ":"1350","caAlkMgVerbrauchMgEndwert":"1335","caAlk MgVerbrauchMgTage":"70","changeVolume":"3","conduc tivityIst":"0.0000","conductivitySoll":"0.0000","d ensityIst":"10232.0000","densitySoll":"0.0000","re lDensityIst":"0.0000","relDensitySoll":"0.0000","r ez1Stamml":"0","rez2Stamml":"0","rez3Stamml":"1"," rezAlkErhAlk":"88","rezeptur":"3","rezErhCalAlk":" 0","rezErhMagnesium":"100","rezKonzAlk":"100.00"," rezKonzCalcium":"400.00","rezKonzentration":"0","r ezKonzMag":"400.00","rezKonzNaCL":"0.00","rezNaClf reiesSalz":"0","rezTrace1":"1","rezTrace1Quant":"5 .00","rezTrace2":"1","rezTrace2Quant":"5.00","rezT race3":"1","rezTrace3Quant":"5.00","rezTraceTyp1": "Trace-B: Schwermetall Komplex","rezTraceTyp2":"Trace-B: Strontium\/Barium Komp","rezTraceTyp3":"Jod\/Fluor Komplex","salIst":"3478","salSoll":"3480","temp":" 2480","tempF":"7664","volume":"34","wasserwechselM itCaAlkMG":false,"UserID":"52f3c814-2994-4945-adaa-0cd1b01c12f4","name":"ShallowReef","lastChanged":" 2014-10-01 22:04:14","created":"2014-04-13 18:20:00","UID":"FE46A623-94C7-43CD-AF90-7393642B24E6","deleted":false,"laenge":"3000","bre
ite":"3000","tiefe":"4000","established":"2013-04-01","typeid":"56c051c4-ce56-11e3-b688-001c423ac3a5","note":"","like_count":"0","salzid": "","einheitensystem":"0","messmethodeSalz":"0","al kalinitaet":null,"relDichteTemp":"25"}}
Und.... Ja besonders schön erstellt ist die JSON Struktur tatsächlich nicht (Reihenfolge durcheinander gewürfelt, D-Englisch, keine Arrays). Sie stammt von einem Bekannten der diese selbst so zusammengezimmert hat. Ich kann das vermutlich nicht umstellen sondern werde das wohl so übernehmen müssen.
LG Martin