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 获取内网所有ip地址

Delphi 调用外部程序获取程序id,并能关闭该程序

Delphi webbrowser添加到收藏夹

Delphi中dbgrid控件数据库点击某列按序排列

Delphi fmx使用 timage 显示动画图片

Delphi firedac mysql 连接

Delphi 获取本地计算机上的com口列表

Delphi hexstrtobytes

Delphi 下载并运行的代码

Delphi mailurlmaybeinvalid 检测邮箱地址有效性

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



打赏

取消

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

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

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

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

评论

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