JSON序列——保存修改数据
procedure TForm1.Button6Click(Sender: TObject); begin var delta: TynJsonDelta := TynJsonDelta.Create('tunit'); try delta.Insert('{"unitid":"13","unitname":"人"}'); delta.Delete('{"unitid":"66","unitname":"国"}'); delta.Update('{"unitid":"11","unitname":"中"}', '{"unitid":"11","unitname":"个"}'); Memo1.Text := delta.Text; finally delta.Free; end; end;
生成JSON:
{ "table": "tunit", "rows": [ { "action": "insert", "current": { "unitid": "13", "unitname": "人" } }, { "action": "delete", "original": { "unitid": "66", "unitname": "国" } }, { "action": "modify", "current": { "unitid": "11", "unitname": "中" }, "original": { "unitid": "11", "unitname": "个" } } ] }