Delphi datasnap 的HTTP 调用返回JSON


本文整理自网络,侵删。

 
datasnap 的HTTP 调用返回JSON
datasnap 相关设置,就不细说了,直接上函数

uses System.JSON
function TServerMethods.Updatehello: Tjsonobject;
var
temp:tjsonobject;
begin
temp:=tjsonobject.Create;
temp.AddPair(Tjsonstring.Create('code'),tjsonstring.Create('00000')) ;
temp.AddPair(Tjsonstring.Create('error'),tjsonstring.Create('')) ;
result:=temp;
 
end;
  

调用时,输入地址:

http://127.0.0.1:9001/datasnap/rest/TServerMethods/Updatehello

返回结果

1
{"result":[{"code":"00000","error":""}]}

相关阅读 >>

Delphi 基础计算两数之合

Delphi unigui服务器部署

Delphi twebbrowser 屏蔽右键菜单

Delphi 增加/获得windows用户帐号

Delphi响应wmi事件(响应网线断开)

Delphi xe下的fmx中压缩图片

封装Delphi hook api

Delphi下获取ie的useragent的方法

Delphi中使用flash控件

Delphi控制摄像头

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...