Parsing JSON string with Jxon library Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Parsing JSON string with Jxon library

17 Mar 2024, 15:07

Hi Folks,

I'm using the Jxon.ahk (Lib function). I understand the AHK assignment statement syntax after calling oJxon:=Jxon_Load(jsonvar). For example, with this JSON data subset...

Code: Select all

{
  "log": {
    "version": "1.1",
    "creator": {
      "name": "HelloWorld",
      "version": "123.45"
    },
    "pages": [
      {
        "timestarted": "2024-03-17T13:15:48",
        "id": "page_3",
        "title": "https://www.test.com"
      }
    ],
...the assignment statments for version and name are:

Code: Select all

LogVersion:=oJxon.log.version
LogCreatorName:=oJxon.log.creator.name
Works great! But I can't figure out how to get the array elements. For example, let's say the Jxon call is oJxon:=Jxon_Load(jsonvar,objBase,arrBase). What is the assignment statement for the timestarted element?

Thanks much, Joe
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Parsing JSON string with Jxon library  Topic is solved

20 Mar 2024, 12:52

MsgBox % oJxon.log.pages[1].timestarted or MsgBox % oJxon.log.pages.1.timestarted
User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: Parsing JSON string with Jxon library

20 Mar 2024, 13:30

Hi @geek,
Thank you very much! Both methods work perfectly! Regards, Joe

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, Bing [Bot], loek6000 and 182 guests