Registriert seit: 18. Mär 2004
Ort: Luxembourg
3.492 Beiträge
Delphi 7 Enterprise
|
AW: JSON Wert zufügen
16. Feb 2022, 18:20
Hier das funktionierende Codefragment.
Delphi-Quellcode:
uses
System.JSON;
const
JSONDATA =
'{"Version":"1","ID":"Zeptor","IncompatibleIds":["Jokola"],"Dependent":null,' +
'"Lapforce":{"English":"much","French":null,"German":"Viel","Italian":null,' +
'"Japanese":null,"Korean":null,"Polish":null,"Russian":null,"Spanish":null,' +
'"Taiwanese":null},"Score":[{"English":"much","French":null,"German":' +
'"Viel","Italian":null,"Japanese":null,"Korean":null,"Polish":null,' +
'"Russian":null,"Spanish":null,"Taiwanese":null}],"Name":"Turandot","Contact":"","Image":null}';
procedure ProcessJSON;
procedure InsertCzech(AObject : TJSONValue);
begin
TJSONObject(AObject).AddPair('Czech', TJSONNull.Create);
end;
var
LData : TJSONValue;
LArray : TJSONArray;
LItem : TJSONValue;
begin
LData := TJSONObject.ParseJSONValue(JSONDATA);
LItem := LData.FindValue('Lapforce');
InsertCzech(LItem);
LArray := TJsonArray(LData.FindValue('Score'));
for LItem in LArray do
InsertCzech(TJSONObject(LItem));
end;
Ibi fas ubi proxima merces
sudo /Developer/Library/uninstall-devtools --mode=all
|
|
Zitat
|