json() [v2.0]

Author: Titan Last Modified: 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 = "")

For the functions's parameters and return value, please see it's source code.

Remarks

It is not strictly stdlib conform, because it uses a global variable.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic16367.html

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic34565.html

License

The functions is an open source item under the Simplified BSD license.
For details, please see titan-license.txt

Example

; #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