(Delphi ActiveX) JSON Append String Array
Demonstrates how to append an array of strings from a string table object.
Note: This example uses the AppendStringTable method, which was introduced in Chilkat v9.5.0.67
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
json: TChilkatJsonObject;
st: TChilkatStringTable;
begin
json := TChilkatJsonObject.Create(Self);
json.EmitCompact := 0;
json.AppendString('abc','123');
st := TChilkatStringTable.Create(Self);
st.Append('a');
st.Append('b');
st.Append('c');
st.Append('d');
json.AppendStringArray('strArray',st.ControlInterface);
Memo1.Lines.Add(json.Emit());
// Output:
// {
// "abc": "123",
// "strArray": [
// "a",
// "b",
// "c",
// "d"
// ]
// }
end;
|