json() [v2.0]

作者: Titan 最近更新时间: nonexistent


I wrote this to help with automated hacking of my xulrunner/prism code. Others may also find it useful as a faster and more compact alternative to XML or INI.

json(ByRef js, s, v = "")

关于函数的参数和返回值, 请参阅其源码.

备注

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/topic34565.html

许可

此函数(集)是基于 Simplified BSD 许可的开源项目. 想了解许可详情, 请参见 titan-license.txt

示例

; #Include json.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

; JSON string:
j = {"version":"1","window":{"state":3,"screenX":25,"screenY":25,"width":790,"height":605,"test":{"nested":"object"}},"sidebar":{"visible":false,"width":"200"}}
MsgBox, % json(j, "version") ; returns "1"
MsgBox, % json(j, "window.width", 800) ; returns 790, sets window->width to 800

r = { "a" : true, "b" : [ 1, [ 2.1, 2.2, { "sub" : false, "test" : [ null, "pass" ] } ], 3 ] }
MsgBox, % json(r, "b[1][2].test[1]") ; array support