Skip to content

Instantly share code, notes, and snippets.

@grey-code
Created May 12, 2013 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grey-code/5565115 to your computer and use it in GitHub Desktop.
Save grey-code/5565115 to your computer and use it in GitHub Desktop.
AutoHotkey: Obj2Str()
Obj2Str(obj) {
str := "" , array := true
for k in obj {
if (k == A_Index)
continue
array := false
break
}
for a, b in obj
str .= (array ? "" : "'" a "': ") . (IsObject(b) ? Obj2Str(b) : "'" b "'") . ", "
str := RTrim(str, " ,")
return (array ? "[" str "]" : "{" str "}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment