This is what the json looks like when I query a cell value.
Code: Select all
{
"range": "Sheet1!A2",
"majorDimension": "ROWS",
"values": [
[
"English"
]
]
}
Thanks
Code: Select all
{
"range": "Sheet1!A2",
"majorDimension": "ROWS",
"values": [
[
"English"
]
]
}
Code: Select all
q:: ;JSON example
vText = ;continuation section
(
{
"range": "Sheet1!A2",
"majorDimension": "ROWS",
"values": [
[
"English"
]
]
}
)
oArray := JSON.Load(vText) ;JSON string to AHK array
vOutput := ""
. oArray.range "`r`n"
. oArray.majorDimension "`r`n"
. oArray.values.1.1
oArray.values.1.1 := "NEW VALUE" ;change the value
MsgBox, % vText ;original JSON string
MsgBox, % vOutput ;values from AHK array
MsgBox, % vOutput2 := JSON.Dump(oArray,, 4) ;AHK array to JSON string
MsgBox, % vOutput2 := JSON.Dump(oArray) ;AHK array to JSON string
;note: the JSON library creates a string, where the keys are in alphabetical order
oArray := ""
return
;JSON 2.0 (and Jxon) - JSON lib for AutoHotkey - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=627
;GitHub - cocobelgica/AutoHotkey-JSON: JSON module for AutoHotkey
;https://github.com/cocobelgica/AutoHotkey-JSON
#Include, %A_ScriptDir%\Lib\JSON.ahk ;change or comment this out as appropriate
Users browsing this forum: CoffeeChaton and 140 guests