Help with json_toobj? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
slimpickens
Posts: 9
Joined: 04 Jul 2017, 06:41

Help with json_toobj?

26 Jul 2017, 14:35

Code: Select all

#include json2obj.ahk

; this works...
; Google sheets data from python
pyServer := ComObjCreate("Python.gServer")
objScores := json_toobj(pyServer.getScores()) ; getScores returns [["andy", 2421], ["bryan", 3713], ["dave", 1334], ["elon", 7497]]

; Get json via python API
pyExtServer := ComObjCreate("Python.extServer")

jsonDashboard := pyExtServer.getJson() 
; jsonDashboard returns {"data": {"name": "bigtony", "score": 1019, "kills": 10, "head_shots": 2, "spawn": 9, "profile_url": "", "live": 6, "online": false, "active": false, "free_weapons": 4, "top_score": 21, "currency": 0, "moto": "", "last_seen": "2017-07-09T12:01:02+00:00", "fouls": 0, "age-range": "21-30", "date_created": "2016-10-10T21:31:55+00:00", "p_packs": "98"}}

; this comes up empty...
objDashboard := json_toobj(jsonDashboard)

kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Help with json_toobj?  Topic is solved

26 Jul 2017, 19:15

It seems to work for me. Are you doing it like this?

Code: Select all

s = {"data": {"name": "bigtony", "score": 1019, "kills": 10, "head_shots": 2, "spawn": 9, "profile_url": "", "live": 6, "online": false, "active": false, "free_weapons": 4, "top_score": 21, "currency": 0, "moto": "", "last_seen": "2017-07-09T12:01:02+00:00", "fouls": 0, "age-range": "21-30", "date_created": "2016-10-10T21:31:55+00:00", "p_packs": "98"}}
MyObj := json_toobj(s)  ; json_toobj @ https://autohotkey.com/boards/viewtopic.php?t=30
MsgBox, % MyObj.data.head_shots
HTH :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: FanaticGuru and 327 guests