• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

craigmj/json4lua: JSON (Javascript Object Notation - http://www.json.org) encodi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

craigmj/json4lua

开源软件地址(OpenSource Url):

https://github.com/craigmj/json4lua

开源编程语言(OpenSource Language):

Lua 100.0%

开源软件介绍(OpenSource Introduction):

json4lua

JSON and JSONRPC for Lua

Installation

luarocks install --server=http://rocks.moonscript.org/manifests/amrhassan --local json4Lua

JSON Usage

Encoding

json = require('json')
print(json.encode({ 1, 2, 'fred', {first='mars',second='venus',third='earth'} }))
[1,2,"fred", {"first":"mars","second":"venus","third":"earth"}]

Decoding

json = require("json")
testString = [[ { "one":1 , "two":2, "primes":[2,3,5,7] } ]]
decoded = json.decode(testString)
table.foreach(decoded, print)
print ("Primes are:")
table.foreach(decoded.primes,print)
one		1
two		2
primes		table: 0032B928
Primes are:
1		2
2		3
3		5
4		7

JSONRPC Usage

json = require('json')
require("json.rpc")
server = json.rpc.proxy("http://jsolait.net/testj.py")
result, error = server.echo('Test echo!')
print(result)
Test echo!



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
JSON发布时间:2022-08-16
下一篇:
daurnimator/lua-http: HTTP Library for Lua. Supports HTTP(S) 1.0, 1.1 and 2.0; c ...发布时间:2022-08-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap