uses DataSet.Serialize, fpjson;
var obj:tjsonobject; procedure TForm1.Button1Click(Sender: TObject); begin uniquery1.Close; uniquery1.SQL.clear; uniquery1.sql.Add('select top 2 * from tunit'); uniquery1.Open; memo1.text:=uniquery1.ToJSONArrayString; //[{ "unitid" : "10", "unitname" : "双" }, { "unitid" : "1000", "unitname" : "床" }] //obj:=tjsonobject.Create; //obj.add('ds1',uniquery1.ToJSONArray); //memo1.Text:=obj.AsJSON; //{ "ds1" : [{ "unitid" : "10", "unitname" : "双" }, { "unitid" : "1000", "unitname" : "床" }] } ///obj.free; end;
标签:obj,unitname,JSON,lazarus,unitid,序列,uniquery1 From: https://www.cnblogs.com/hnxxcxg/p/18157484