JsonDataObjects git 下载网址
2016-09-16 00:00
771 查看
https://github.com/ahausladen/JsonDataObjects
Usage Simple example var Obj: TJsonObject; begin Obj := TJsonObject.Parse('{ "foo": "bar", "array": [ 10, 20 ] }') as TJsonObject; try ShowMessage(Obj['foo']); ShowMessage(IntToStr(Obj['array'].Count)); ShowMessage(IntToStr(Obj['array'].Items[0])); ShowMessage(IntToStr(Obj['array'].Items[1])); finally Obj.Free; end; end; Filling and serializing JSON objects var Obj, ChildObj: TJsonObject; begin Obj := TJsonObject.Create; try // easy access Obj['foo'] := 'bar'; // normal (and faster) access Obj.S['bar'] := 'foo'; // automatic array creation, Obj is the owner of 'array' Obj.A['array'].Add(10); Obj.A['array'].Add(20); // automatic object creation, 'array' is the owner of ChildObj ChildObj := Obj.A['array'].AddObject; ChildObj['value'] := 12.3; // automatic array creation, ChildObj is the owner of 'subarray' ChildObj.A['subarray'].Add(100); ChildObj.A['subarray'].Add(200); ShowMessage(Obj.ToJSON({Compact:=}False)); finally Obj.Free; end; { "foo": "bar", "bar": "foo", "array": [ 10, 20, { "value": 12.3, "subarray": [ 100, 200 ] } ] } Copying JSON objects with Assign var Obj, ClonedObj: TJsonObject; begin Obj := TJsonObject.ParseUtf8('{ "foo": [ "bar", {}, null, true, false, { "key": "value" } ] }') as TJsonObject; try ClonedObj := TJsonObject.Create; try // Make a copy of Obj ClonedObj.Assign(Obj); ShowMessage(ClonedObj.ToJSON(False)); finally ClonedObj.Free; end; finally Obj.Free; end; end; { "foo": [ "bar", {}, null, true, false, { "key": "value" } ] }
相关文章推荐
- git下载源码时只有.git\objects\pack目录下的.pa
- JsonDataObjects 简单实用
- git fetch 从另一个repository中下载objects and refs
- JsonDataObjects基本演示
- JsonDataObjects 简单实用
- JsonDataObjects基本演示
- Open Data Plane (ODP) 源码下载(git 服务器搭建)
- JsonDataObjects序列和还原
- JsonDataObjects序列和还原
- 解决一个小问题:git下载Kernel源码时只有.git\objects\pack目录下的.pack文件,而没有自动提取
- git clone 下载速度0bytes 出现error: RPC failed; curl 18 transfer closed with outstanding read data 解决办法
- 找到一个电子书下载网址,发出来SHARE一下
- A Data Access Layer to persist business objects using attributes and reflection - Part III
- 13G编程电子书开始提供BT下载,下载说明及BT种子下载网址
- Eclipse及其插件下载网址大全
- 下载电子书的网址收集...
- 电子书下载网址大全
- Preloading Data with Ajax and JSON
- 国内完全免费的电子图书下载网址
- VS2005web应用程序项目教程(4)Data Binding against Objects