Einzelnen Beitrag anzeigen

Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.006 Beiträge
 
Delphi 12 Athens
 
#3

AW: JSON valuePair entfernen

  Alt 6. Sep 2021, 17:28
Delphi-Quellcode:
var
  aJSON: TJSONValue;
  aJSONObj: TJSONObject;
  aJSONStr: string;
begin
  aJSONStr := '{"price": { "dealerPriceGross": "535.50", "vatRate": "1.23", "currency": "EUR" }}';
  aJSON := TJSONObject.ParseJSONValue(aJSONStr);
  aJSONObj := aJSON.GetValue<TJSONObject>('price');
  aJSONObj.RemovePair('vatRate');
  aJSONStr := aJSON.ToJSON;
end;
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat