question about array Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SkyLife
Posts: 19
Joined: 18 May 2017, 20:53

question about array

28 Sep 2018, 11:26

I have a text file(XXX.txt), and it`s content : {"A":{},"B":{},"C":{"a":["a1","a2","a3","a4"],"b":[],"c":[],"d":[],"e":[]}}

this is a string,but i need to convert it into a array.

when I use "fileread" , it always store as value, not an object.
awel20
Posts: 211
Joined: 19 Mar 2018, 14:09

Re: question about array  Topic is solved

28 Sep 2018, 11:42

Code: Select all

#Include JSON.ahk ; https://github.com/cocobelgica/AutoHotkey-JSON
testText = {"A":{},"B":{},"C":{"a":["a1","a2","a3","a4"],"b":[],"c":[],"d":[],"e":[]}}
value := JSON.Load(testText)
MsgBox % value.c.a.1
Guest

Re: question about array

28 Sep 2018, 11:43

You can't save/read objects like that directly, so you would either have to write your own parser (converting the FileRead data to an object).
Or use other formats such as XML, CSV, JSON or "binary" - see the XA (xml), ObjCSV, AutoHotkey-JSON or ObjDump/ObjLoad (binary), each has its pros and cons.
SkyLife
Posts: 19
Joined: 18 May 2017, 20:53

Re: question about array

28 Sep 2018, 11:54

thank for your helping!
it works perfect!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Spawnova, william_ahk and 247 guests