This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

json to nested dict

Help for those learning Tcl or writing their own scripts.
Post Reply
j
johne
Voice
Posts: 29
Joined: Tue Jul 19, 2005 2:24 am

json to nested dict

Post by johne »

after converting a json feed to tcl dict i'm not able to get the values I need, is this a problem with the json format or something im doing wrong?


http://pastebin.com/19mRWFKZ post json2dict

to get the value im using

dict get $json data game plays play

which returns

Code: Select all

{sweater 25 hs 0 aoi {8462042 8467338 8469664 8470151 8470966 8475431} desc {David Moss SHOT on Jaroslav Halak} formalEventId STL54 type Shot eventid 54 hsog 0 asog 1 apb {} p2name {Jaroslav Halak} time 00:26 localtime {1:08 PM} teamid 20 xcoord -53 strength 701 as 0 pid 8469664 period 1 p3name {} hpb {} pid3 {} ycoord 29 playername {David Moss} hoi {8470860 8471348 8471392 8471698 8473485 8473534} p1name {David Moss} pid2 8470860 pid1 8469664} {sweater 5 hs 0 aoi {8466140 8466158 847074....
im trying to get the "desc" key "David Moss SHOT on Jaroslav Halak"

any help would be greatly appreciated.
j
johne
Voice
Posts: 29
Joined: Tue Jul 19, 2005 2:24 am

Post by johne »

<speechl3s> johne --v
<speechl3s> foreach entry [dict get $json data game plays play] {
<speechl3s> dict with entry {
<speechl3s> puts "desc=$desc"
<speechl3s> }
<speechl3s> }
Post Reply