Übertragen eines Json-Strings in eine TreeView funktioniert nur teilweise (AHK 1.1.33.6) Topic is solved

Stelle Fragen zur Automatisierung von Spielen

Moderator: jNizM

wirthts
Posts: 6
Joined: 24 Apr 2019, 05:00
Contact:

Übertragen eines Json-Strings in eine TreeView funktioniert nur teilweise (AHK 1.1.33.6)

Post by wirthts » 31 Mar 2021, 08:22

Hallo zusammen,

ich versuche seit ein paar Tagen einen Json-String per Objekt in ein TreeView zu übertragen. Mit der ersten Ebene habe ich kaum Probleme, geht es aber tiefer im String voran, scheitere ich. Es wird immer ein leerer Wert übertragen. Ich habe auch versucht per for-Schleife und MsgBox Befehl mir die Werte anzeigen zu lassen, aber irgendwie scheint mir die Tiefe des Strings einen Strich durch die Rechnung zu machen (das glaube ich zumindest). Der Zusatz fürs JSON auslesen ist der hier: cocobelgica/AutoHotkey-JSON (https://github.com/cocobelgica/AutoHotkey-JSON).

Die Json-Strings liegen als Datei vor, da sie von klein bis zu komplex verschachtelt und groß gehen. Mein AHK-Skript und ein beispielhafter Json-String habe ich am Schluss rein kopiert.
Meinen Hänger habe ich in meinem AHK-Skript ab Zeile 32. Egal was im Json steht, der Bereich "value" bleibt leer. Ich komm auch nicht an die Daten da ran. Einzig und allein der Bereich "AreaProperties" ist etwas ausführlicher, aber sobald es noch mehr verschachtelt, liest es nicht weiter aus.

Hat mir jemand einen Tipp, wie ich die Daten irgendwie ausgelesen bekomme?

Ich habe hier einmal mein AHK:

Code: Select all

#Include JSON.ahk

Main:
  Gui Add, DDL,       x6 y6             vDdlView  gDdlView  , Laden|
  Gui Add, TreeView,  x6 y30 h100 w200  vtTreeView          , 
  Gui Show, Center Autosize, Test
Return

DdlView:
  Gui, Submit, NoHide                             ; submit data
  
  if (DdlView == "Laden")                         ; Load choosen
  {
    TV_Delete()                                   ; empty treeview
    FileSelectFile, LoadFile, 3, , , JSON-File (*.json)
    FileRead, a, %LoadFile%                       ; take path from previous FileSelectFile
    b := JSON.Load(a)                             ; JSON.Load by cocobelgica (from github)
    
    GuiControl, , DdlView, |                      ; clear up before adding
    if (b["__data_type"] == "GIT ")
      d = Laden|AreaProperties|Creature List|Door List|Encounter List|Placeable List|SoundList|StoreList|TriggerList|WaypointList
    
    GuiControl, , DdlView, % d                    ; update DDL
  }
  else
  {
    s = 
    TV_Delete()                                   ; empty treeview
    c := b[DdlView]                               ; look for choosen part in the json-file
    GuiControl, -Redraw, tTreeView                ; pause redrawing the treeview
    
    Pa := TV_Add(DdlView)                         ; TODO: find a way to add all the stuff?
    for index, wert in c                          ; for-loop to add first
    {
      s .= index " = " wert "`n"
      Ch := TV_Add(index, Pa)
            TV_Add(wert,  Ch)
    }
    
    MsgBox, % s                                   ; Debug MsgBox
    GuiControl, +Redraw, tTreeView                ; redraw it
  }
Return

; Ends app and destroys program
GuiClose:
GuiEscape:
  ExitApp
Und hier den Inhalt der Json-Datei, die ich per FileSelectFile aufrufe:

Code: Select all

{"__data_type":"GIT ","AreaProperties":{"__struct_id":100,"type":"struct","value":{"__struct_id":100,"AmbientSndDay":{"type":"int","value":31},"AmbientSndDayVol":{"type":"int","value":32},"AmbientSndNight":{"type":"int","value":31},"AmbientSndNitVol":{"type":"int","value":32},"EnvAudio":{"type":"int","value":0},"MusicBattle":{"type":"int","value":34},"MusicDay":{"type":"int","value":20},"MusicDelay":{"type":"int","value":90000},"MusicNight":{"type":"int","value":20}}},"Creature List":{"type":"list","value":[]},"Door List":{"type":"list","value":[{"__struct_id":8,"AnimationState":{"type":"byte","value":0},"Appearance":{"type":"dword","value":0},"AutoRemoveKey":{"type":"byte","value":0},"Bearing":{"type":"float","value":-0.0},"CloseLockDC":{"type":"byte","value":0},"Conversation":{"type":"resref","value":""},"CurrentHP":{"type":"short","value":10000},"Description":{"id":9078,"type":"cexolocstring","value":{}},"DisarmDC":{"type":"byte","value":15},"Faction":{"type":"dword","value":1},"Fort":{"type":"byte","value":250},"GenericType_New":{"type":"dword","value":20},"Hardness":{"type":"byte","value":250},"HP":{"type":"short","value":10000},"Interruptable":{"type":"byte","value":1},"KeyName":{"type":"cexostring","value":""},"KeyRequired":{"type":"byte","value":0},"LinkedTo":{"type":"cexostring","value":""},"LinkedToFlags":{"type":"byte","value":0},"LoadScreenID":{"type":"word","value":0},"Lockable":{"type":"byte","value":1},"Locked":{"type":"byte","value":0},"LocName":{"id":5349,"type":"cexolocstring","value":{"4":"Tür"}},"OnClick":{"type":"resref","value":""},"OnClosed":{"type":"resref","value":""},"OnDamaged":{"type":"resref","value":""},"OnDeath":{"type":"resref","value":"x2_door_death"},"OnDisarm":{"type":"resref","value":""},"OnFailToOpen":{"type":"resref","value":""},"OnHeartbeat":{"type":"resref","value":""},"OnLock":{"type":"resref","value":""},"OnMeleeAttacked":{"type":"resref","value":""},"OnOpen":{"type":"resref","value":""},"OnSpellCastAt":{"type":"resref","value":""},"OnTrapTriggered":{"type":"resref","value":""},"OnUnlock":{"type":"resref","value":""},"OnUserDefined":{"type":"resref","value":""},"OpenLockDC":{"type":"byte","value":18},"Plot":{"type":"byte","value":1},"PortraitId":{"type":"word","value":0},"Ref":{"type":"byte","value":250},"Tag":{"type":"cexostring","value":"DR_Unterwegs"},"TemplateResRef":{"type":"resref","value":"x3_door_wood004"},"TrapDetectable":{"type":"byte","value":1},"TrapDetectDC":{"type":"byte","value":0},"TrapDisarmable":{"type":"byte","value":1},"TrapFlag":{"type":"byte","value":0},"TrapOneShot":{"type":"byte","value":1},"TrapType":{"type":"byte","value":0},"Will":{"type":"byte","value":250},"X":{"type":"float","value":15.0},"Y":{"type":"float","value":11.30000019073486},"Z":{"type":"float","value":0.009999999776482582}}]},"Encounter List":{"type":"list","value":[]},"List":{"type":"list","value":[]},"Placeable List":{"type":"list","value":[{"__struct_id":9,"AnimationState":{"type":"byte","value":0},"Appearance":{"type":"dword","value":178},"AutoRemoveKey":{"type":"byte","value":0},"Bearing":{"type":"float","value":-0.0},"BodyBag":{"type":"byte","value":0},"CloseLockDC":{"type":"byte","value":0},"Conversation":{"type":"resref","value":""},"CurrentHP":{"type":"short","value":15},"Description":{"id":14559,"type":"cexolocstring","value":{}},"DisarmDC":{"type":"byte","value":15},"Faction":{"type":"dword","value":1},"Fort":{"type":"byte","value":16},"Hardness":{"type":"byte","value":5},"HasInventory":{"type":"byte","value":0},"HP":{"type":"short","value":15},"Interruptable":{"type":"byte","value":1},"KeyName":{"type":"cexostring","value":""},"KeyRequired":{"type":"byte","value":0},"Lockable":{"type":"byte","value":0},"Locked":{"type":"byte","value":0},"LocName":{"id":5821,"type":"cexolocstring","value":{}},"OnClick":{"type":"resref","value":""},"OnClosed":{"type":"resref","value":""},"OnDamaged":{"type":"resref","value":""},"OnDeath":{"type":"resref","value":""},"OnDisarm":{"type":"resref","value":""},"OnHeartbeat":{"type":"resref","value":""},"OnInvDisturbed":{"type":"resref","value":""},"OnLock":{"type":"resref","value":""},"OnMeleeAttacked":{"type":"resref","value":""},"OnOpen":{"type":"resref","value":""},"OnSpellCastAt":{"type":"resref","value":""},"OnTrapTriggered":{"type":"resref","value":""},"OnUnlock":{"type":"resref","value":""},"OnUsed":{"type":"resref","value":""},"OnUserDefined":{"type":"resref","value":""},"OpenLockDC":{"type":"byte","value":18},"Plot":{"type":"byte","value":0},"PortraitId":{"type":"word","value":536},"Ref":{"type":"byte","value":0},"Static":{"type":"byte","value":1},"Tag":{"type":"cexostring","value":"BenchPew"},"TemplateResRef":{"type":"resref","value":"plc_bench"},"TrapDetectable":{"type":"byte","value":1},"TrapDetectDC":{"type":"byte","value":0},"TrapDisarmable":{"type":"byte","value":1},"TrapFlag":{"type":"byte","value":0},"TrapOneShot":{"type":"byte","value":1},"TrapType":{"type":"byte","value":0},"Type":{"type":"byte","value":0},"Useable":{"type":"byte","value":0},"Will":{"type":"byte","value":0},"X":{"type":"float","value":13.30000019073486},"Y":{"type":"float","value":16.14999961853027},"Z":{"type":"float","value":0.0}},{"__struct_id":9,"AnimationState":{"type":"byte","value":0},"Appearance":{"type":"dword","value":178},"AutoRemoveKey":{"type":"byte","value":0},"Bearing":{"type":"float","value":-0.0},"BodyBag":{"type":"byte","value":0},"CloseLockDC":{"type":"byte","value":0},"Conversation":{"type":"resref","value":""},"CurrentHP":{"type":"short","value":15},"Description":{"id":14559,"type":"cexolocstring","value":{}},"DisarmDC":{"type":"byte","value":15},"Faction":{"type":"dword","value":1},"Fort":{"type":"byte","value":16},"Hardness":{"type":"byte","value":5},"HasInventory":{"type":"byte","value":0},"HP":{"type":"short","value":15},"Interruptable":{"type":"byte","value":1},"KeyName":{"type":"cexostring","value":""},"KeyRequired":{"type":"byte","value":0},"Lockable":{"type":"byte","value":0},"Locked":{"type":"byte","value":0},"LocName":{"id":5821,"type":"cexolocstring","value":{}},"OnClick":{"type":"resref","value":""},"OnClosed":{"type":"resref","value":""},"OnDamaged":{"type":"resref","value":""},"OnDeath":{"type":"resref","value":""},"OnDisarm":{"type":"resref","value":""},"OnHeartbeat":{"type":"resref","value":""},"OnInvDisturbed":{"type":"resref","value":""},"OnLock":{"type":"resref","value":""},"OnMeleeAttacked":{"type":"resref","value":""},"OnOpen":{"type":"resref","value":""},"OnSpellCastAt":{"type":"resref","value":""},"OnTrapTriggered":{"type":"resref","value":""},"OnUnlock":{"type":"resref","value":""},"OnUsed":{"type":"resref","value":""},"OnUserDefined":{"type":"resref","value":""},"OpenLockDC":{"type":"byte","value":18},"Plot":{"type":"byte","value":0},"PortraitId":{"type":"word","value":536},"Ref":{"type":"byte","value":0},"Static":{"type":"byte","value":1},"Tag":{"type":"cexostring","value":"BenchPew"},"TemplateResRef":{"type":"resref","value":"plc_bench"},"TrapDetectable":{"type":"byte","value":1},"TrapDetectDC":{"type":"byte","value":0},"TrapDisarmable":{"type":"byte","value":1},"TrapFlag":{"type":"byte","value":0},"TrapOneShot":{"type":"byte","value":1},"TrapType":{"type":"byte","value":0},"Type":{"type":"byte","value":0},"Useable":{"type":"byte","value":0},"Will":{"type":"byte","value":0},"X":{"type":"float","value":16.70000076293945},"Y":{"type":"float","value":16.14999961853027},"Z":{"type":"float","value":0.0}},{"__struct_id":9,"AnimationState":{"type":"byte","value":0},"Appearance":{"type":"dword","value":178},"AutoRemoveKey":{"type":"byte","value":0},"Bearing":{"type":"float","value":-0.0},"BodyBag":{"type":"byte","value":0},"CloseLockDC":{"type":"byte","value":0},"Conversation":{"type":"resref","value":""},"CurrentHP":{"type":"short","value":15},"Description":{"id":14559,"type":"cexolocstring","value":{}},"DisarmDC":{"type":"byte","value":15},"Faction":{"type":"dword","value":1},"Fort":{"type":"byte","value":16},"Hardness":{"type":"byte","value":5},"HasInventory":{"type":"byte","value":0},"HP":{"type":"short","value":15},"Interruptable":{"type":"byte","value":1},"KeyName":{"type":"cexostring","value":""},"KeyRequired":{"type":"byte","value":0},"Lockable":{"type":"byte","value":0},"Locked":{"type":"byte","value":0},"LocName":{"id":5821,"type":"cexolocstring","value":{}},"OnClick":{"type":"resref","value":""},"OnClosed":{"type":"resref","value":""},"OnDamaged":{"type":"resref","value":""},"OnDeath":{"type":"resref","value":""},"OnDisarm":{"type":"resref","value":""},"OnHeartbeat":{"type":"resref","value":""},"OnInvDisturbed":{"type":"resref","value":""},"OnLock":{"type":"resref","value":""},"OnMeleeAttacked":{"type":"resref","value":""},"OnOpen":{"type":"resref","value":""},"OnSpellCastAt":{"type":"resref","value":""},"OnTrapTriggered":{"type":"resref","value":""},"OnUnlock":{"type":"resref","value":""},"OnUsed":{"type":"resref","value":""},"OnUserDefined":{"type":"resref","value":""},"OpenLockDC":{"type":"byte","value":18},"Plot":{"type":"byte","value":0},"PortraitId":{"type":"word","value":536},"Ref":{"type":"byte","value":0},"Static":{"type":"byte","value":1},"Tag":{"type":"cexostring","value":"BenchPew"},"TemplateResRef":{"type":"resref","value":"plc_bench"},"TrapDetectable":{"type":"byte","value":1},"TrapDetectDC":{"type":"byte","value":0},"TrapDisarmable":{"type":"byte","value":1},"TrapFlag":{"type":"byte","value":0},"TrapOneShot":{"type":"byte","value":1},"TrapType":{"type":"byte","value":0},"Type":{"type":"byte","value":0},"Useable":{"type":"byte","value":0},"Will":{"type":"byte","value":0},"X":{"type":"float","value":16.70000076293945},"Y":{"type":"float","value":14.5},"Z":{"type":"float","value":0.0}},{"__struct_id":9,"AnimationState":{"type":"byte","value":0},"Appearance":{"type":"dword","value":178},"AutoRemoveKey":{"type":"byte","value":0},"Bearing":{"type":"float","value":-0.0},"BodyBag":{"type":"byte","value":0},"CloseLockDC":{"type":"byte","value":0},"Conversation":{"type":"resref","value":""},"CurrentHP":{"type":"short","value":15},"Description":{"id":14559,"type":"cexolocstring","value":{}},"DisarmDC":{"type":"byte","value":15},"Faction":{"type":"dword","value":1},"Fort":{"type":"byte","value":16},"Hardness":{"type":"byte","value":5},"HasInventory":{"type":"byte","value":0},"HP":{"type":"short","value":15},"Interruptable":{"type":"byte","value":1},"KeyName":{"type":"cexostring","value":""},"KeyRequired":{"type":"byte","value":0},"Lockable":{"type":"byte","value":0},"Locked":{"type":"byte","value":0},"LocName":{"id":5821,"type":"cexolocstring","value":{}},"OnClick":{"type":"resref","value":""},"OnClosed":{"type":"resref","value":""},"OnDamaged":{"type":"resref","value":""},"OnDeath":{"type":"resref","value":""},"OnDisarm":{"type":"resref","value":""},"OnHeartbeat":{"type":"resref","value":""},"OnInvDisturbed":{"type":"resref","value":""},"OnLock":{"type":"resref","value":""},"OnMeleeAttacked":{"type":"resref","value":""},"OnOpen":{"type":"resref","value":""},"OnSpellCastAt":{"type":"resref","value":""},"OnTrapTriggered":{"type":"resref","value":""},"OnUnlock":{"type":"resref","value":""},"OnUsed":{"type":"resref","value":""},"OnUserDefined":{"type":"resref","value":""},"OpenLockDC":{"type":"byte","value":18},"Plot":{"type":"byte","value":0},"PortraitId":{"type":"word","value":536},"Ref":{"type":"byte","value":0},"Static":{"type":"byte","value":1},"Tag":{"type":"cexostring","value":"BenchPew"},"TemplateResRef":{"type":"resref","value":"plc_bench"},"TrapDetectable":{"type":"byte","value":1},"TrapDetectDC":{"type":"byte","value":0},"TrapDisarmable":{"type":"byte","value":1},"TrapFlag":{"type":"byte","value":0},"TrapOneShot":{"type":"byte","value":1},"TrapType":{"type":"byte","value":0},"Type":{"type":"byte","value":0},"Useable":{"type":"byte","value":0},"Will":{"type":"byte","value":0},"X":{"type":"float","value":13.30000019073486},"Y":{"type":"float","value":14.5},"Z":{"type":"float","value":0.0}},{"__struct_id":9,"AnimationState":{"type":"byte","value":0},"Appearance":{"type":"dword","value":287},"AutoRemoveKey":{"type":"byte","value":0},"Bearing":{"type":"float","value":-0.0},"BodyBag":{"type":"byte","value":0},"CloseLockDC":{"type":"byte","value":0},"Conversation":{"type":"resref","value":""},"CurrentHP":{"type":"short","value":15},"Description":{"id":68858,"type":"cexolocstring","value":{}},"DisarmDC":{"type":"byte","value":15},"Faction":{"type":"dword","value":4294967295},"Fort":{"type":"byte","value":16},"Hardness":{"type":"byte","value":5},"HasInventory":{"type":"byte","value":0},"HP":{"type":"short","value":15},"Interruptable":{"type":"byte","value":1},"KeyName":{"type":"cexostring","value":""},"KeyRequired":{"type":"byte","value":0},"Lockable":{"type":"byte","value":0},"Locked":{"type":"byte","value":0},"LocName":{"id":68857,"type":"cexolocstring","value":{}},"OnClick":{"type":"resref","value":""},"OnClosed":{"type":"resref","value":""},"OnDamaged":{"type":"resref","value":""},"OnDeath":{"type":"resref","value":""},"OnDisarm":{"type":"resref","value":""},"OnHeartbeat":{"type":"resref","value":""},"OnInvDisturbed":{"type":"resref","value":""},"OnLock":{"type":"resref","value":""},"OnMeleeAttacked":{"type":"resref","value":""},"OnOpen":{"type":"resref","value":""},"OnSpellCastAt":{"type":"resref","value":""},"OnTrapTriggered":{"type":"resref","value":""},"OnUnlock":{"type":"resref","value":""},"OnUsed":{"type":"resref","value":""},"OnUserDefined":{"type":"resref","value":""},"OpenLockDC":{"type":"byte","value":18},"Plot":{"type":"byte","value":0},"PortraitId":{"type":"word","value":0},"Ref":{"type":"byte","value":0},"Static":{"type":"byte","value":1},"Tag":{"type":"cexostring","value":"x0_largebench"},"TemplateResRef":{"type":"resref","value":"x0_largebench"},"TrapDetectable":{"type":"byte","value":1},"TrapDetectDC":{"type":"byte","value":0},"TrapDisarmable":{"type":"byte","value":1},"TrapFlag":{"type":"byte","value":0},"TrapOneShot":{"type":"byte","value":1},"TrapType":{"type":"byte","value":0},"Type":{"type":"byte","value":0},"Useable":{"type":"byte","value":0},"Will":{"type":"byte","value":0},"X":{"type":"float","value":15.0},"Y":{"type":"float","value":18.25},"Z":{"type":"float","value":0.0}}]},"SoundList":{"type":"list","value":[]},"StoreList":{"type":"list","value":[]},"TriggerList":{"type":"list","value":[]},"WaypointList":{"type":"list","value":[{"__struct_id":5,"Appearance":{"type":"byte","value":1},"Description":{"type":"cexolocstring","value":{}},"HasMapNote":{"type":"byte","value":0},"LinkedTo":{"type":"cexostring","value":""},"LocalizedName":{"id":14817,"type":"cexolocstring","value":{}},"MapNote":{"type":"cexolocstring","value":{}},"MapNoteEnabled":{"type":"byte","value":1},"Tag":{"type":"cexostring","value":"hw_travshop001"},"TemplateResRef":{"type":"resref","value":"nw_waypoint001"},"XOrientation":{"type":"float","value":-1.0},"XPosition":{"type":"float","value":13.5},"YOrientation":{"type":"float","value":2.102055759678478e-006},"YPosition":{"type":"float","value":15.39999961853027},"ZPosition":{"type":"float","value":-5.7220458984375e-006}}]}}
Last edited by BoBo on 31 Mar 2021, 11:28, edited 1 time in total.
Reason: Nach 'Spiele' verschoben.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Übertragen eines Json-Strings in eine TreeView funktioniert nur teilweise (AHK 1.1.33.6)  Topic is solved

Post by BoBo » 31 Mar 2021, 11:07

Werde nicht so ganz schlau was deine Beschreibung betrifft, doch das hier funzt bei mir schon mal ...

Code: Select all

txt = {"__data_type":"GIT ","AreaProperties":{"__struct_id":100,"type":"struct","value":{"__struct_id":100,"AmbientSndDay":{"type":"int","value":31},"AmbientSndDayVol":{"type":"int","value":32},"AmbientSndNight":{"type":"int","value":31},"AmbientSndNitVol":{"type":"int","value":32},"EnvAudio":{"type":"int","value":0},"MusicBattle":{"type":"int","value":34},"MusicDay":{"type":"int","value":20},"MusicDelay":{"type":"int","value":90000},"MusicNight":{"type":"int","value":20}}}}

obj:= JSON.Load(txt)
MsgBox % obj.AreaProperties.value.AmbientSndDay.type "`n" obj.AreaProperties.value.MusicBattle.value
Wenn ich danach gehe, wird da nicht viel tiefer gestaffelt?

Code: Select all

;	https://jsonformatter.curiousconcept.com/#
{
   "__data_type":"GIT ",
   "AreaProperties":{
      "__struct_id":100,
      "type":"struct",
      "value":{
         "__struct_id":100,
         "AmbientSndDay":{
            "type":"int",
            "value":31
         },
         "AmbientSndDayVol":{
            "type":"int",
            "value":32
         },
         "AmbientSndNight":{
            "type":"int",
            "value":31
         },
         "AmbientSndNitVol":{
            "type":"int",
            "value":32
         },
         "EnvAudio":{
            "type":"int",
            "value":0
         },
         "MusicBattle":{
            "type":"int",
            "value":34
         },
         "MusicDay":{
            "type":"int",
            "value":20
         },
         "MusicDelay":{
            "type":"int",
            "value":90000
         },
         "MusicNight":{
            "type":"int",
            "value":20
         }
      }
   },
   "Creature List":{
      "type":"list",
      "value":[
         
      ]
   },
   "Door List":{
      "type":"list",
      "value":[
         {
            "__struct_id":8,
            "AnimationState":{
               "type":"byte",
               "value":0
            },
            "Appearance":{
               "type":"dword",
               "value":0
            },
            "AutoRemoveKey":{
               "type":"byte",
               "value":0
            },
            "Bearing":{
               "type":"float",
               "value":-0.0
            },
            "CloseLockDC":{
               "type":"byte",
               "value":0
            },
            "Conversation":{
               "type":"resref",
               "value":""
            },
            "CurrentHP":{
               "type":"short",
               "value":10000
            },
            "Description":{
               "id":9078,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "DisarmDC":{
               "type":"byte",
               "value":15
            },
            "Faction":{
               "type":"dword",
               "value":1
            },
            "Fort":{
               "type":"byte",
               "value":250
            },
            "GenericType_New":{
               "type":"dword",
               "value":20
            },
            "Hardness":{
               "type":"byte",
               "value":250
            },
            "HP":{
               "type":"short",
               "value":10000
            },
            "Interruptable":{
               "type":"byte",
               "value":1
            },
            "KeyName":{
               "type":"cexostring",
               "value":""
            },
            "KeyRequired":{
               "type":"byte",
               "value":0
            },
            "LinkedTo":{
               "type":"cexostring",
               "value":""
            },
            "LinkedToFlags":{
               "type":"byte",
               "value":0
            },
            "LoadScreenID":{
               "type":"word",
               "value":0
            },
            "Lockable":{
               "type":"byte",
               "value":1
            },
            "Locked":{
               "type":"byte",
               "value":0
            },
            "LocName":{
               "id":5349,
               "type":"cexolocstring",
               "value":{
                  "4":"Tür"
               }
            },
            "OnClick":{
               "type":"resref",
               "value":""
            },
            "OnClosed":{
               "type":"resref",
               "value":""
            },
            "OnDamaged":{
               "type":"resref",
               "value":""
            },
            "OnDeath":{
               "type":"resref",
               "value":"x2_door_death"
            },
            "OnDisarm":{
               "type":"resref",
               "value":""
            },
            "OnFailToOpen":{
               "type":"resref",
               "value":""
            },
            "OnHeartbeat":{
               "type":"resref",
               "value":""
            },
            "OnLock":{
               "type":"resref",
               "value":""
            },
            "OnMeleeAttacked":{
               "type":"resref",
               "value":""
            },
            "OnOpen":{
               "type":"resref",
               "value":""
            },
            "OnSpellCastAt":{
               "type":"resref",
               "value":""
            },
            "OnTrapTriggered":{
               "type":"resref",
               "value":""
            },
            "OnUnlock":{
               "type":"resref",
               "value":""
            },
            "OnUserDefined":{
               "type":"resref",
               "value":""
            },
            "OpenLockDC":{
               "type":"byte",
               "value":18
            },
            "Plot":{
               "type":"byte",
               "value":1
            },
            "PortraitId":{
               "type":"word",
               "value":0
            },
            "Ref":{
               "type":"byte",
               "value":250
            },
            "Tag":{
               "type":"cexostring",
               "value":"DR_Unterwegs"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"x3_door_wood004"
            },
            "TrapDetectable":{
               "type":"byte",
               "value":1
            },
            "TrapDetectDC":{
               "type":"byte",
               "value":0
            },
            "TrapDisarmable":{
               "type":"byte",
               "value":1
            },
            "TrapFlag":{
               "type":"byte",
               "value":0
            },
            "TrapOneShot":{
               "type":"byte",
               "value":1
            },
            "TrapType":{
               "type":"byte",
               "value":0
            },
            "Will":{
               "type":"byte",
               "value":250
            },
            "X":{
               "type":"float",
               "value":15.0
            },
            "Y":{
               "type":"float",
               "value":11.30000019073486
            },
            "Z":{
               "type":"float",
               "value":0.009999999776482582
            }
         }
      ]
   },
   "Encounter List":{
      "type":"list",
      "value":[
         
      ]
   },
   "List":{
      "type":"list",
      "value":[
         
      ]
   },
   "Placeable List":{
      "type":"list",
      "value":[
         {
            "__struct_id":9,
            "AnimationState":{
               "type":"byte",
               "value":0
            },
            "Appearance":{
               "type":"dword",
               "value":178
            },
            "AutoRemoveKey":{
               "type":"byte",
               "value":0
            },
            "Bearing":{
               "type":"float",
               "value":-0.0
            },
            "BodyBag":{
               "type":"byte",
               "value":0
            },
            "CloseLockDC":{
               "type":"byte",
               "value":0
            },
            "Conversation":{
               "type":"resref",
               "value":""
            },
            "CurrentHP":{
               "type":"short",
               "value":15
            },
            "Description":{
               "id":14559,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "DisarmDC":{
               "type":"byte",
               "value":15
            },
            "Faction":{
               "type":"dword",
               "value":1
            },
            "Fort":{
               "type":"byte",
               "value":16
            },
            "Hardness":{
               "type":"byte",
               "value":5
            },
            "HasInventory":{
               "type":"byte",
               "value":0
            },
            "HP":{
               "type":"short",
               "value":15
            },
            "Interruptable":{
               "type":"byte",
               "value":1
            },
            "KeyName":{
               "type":"cexostring",
               "value":""
            },
            "KeyRequired":{
               "type":"byte",
               "value":0
            },
            "Lockable":{
               "type":"byte",
               "value":0
            },
            "Locked":{
               "type":"byte",
               "value":0
            },
            "LocName":{
               "id":5821,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "OnClick":{
               "type":"resref",
               "value":""
            },
            "OnClosed":{
               "type":"resref",
               "value":""
            },
            "OnDamaged":{
               "type":"resref",
               "value":""
            },
            "OnDeath":{
               "type":"resref",
               "value":""
            },
            "OnDisarm":{
               "type":"resref",
               "value":""
            },
            "OnHeartbeat":{
               "type":"resref",
               "value":""
            },
            "OnInvDisturbed":{
               "type":"resref",
               "value":""
            },
            "OnLock":{
               "type":"resref",
               "value":""
            },
            "OnMeleeAttacked":{
               "type":"resref",
               "value":""
            },
            "OnOpen":{
               "type":"resref",
               "value":""
            },
            "OnSpellCastAt":{
               "type":"resref",
               "value":""
            },
            "OnTrapTriggered":{
               "type":"resref",
               "value":""
            },
            "OnUnlock":{
               "type":"resref",
               "value":""
            },
            "OnUsed":{
               "type":"resref",
               "value":""
            },
            "OnUserDefined":{
               "type":"resref",
               "value":""
            },
            "OpenLockDC":{
               "type":"byte",
               "value":18
            },
            "Plot":{
               "type":"byte",
               "value":0
            },
            "PortraitId":{
               "type":"word",
               "value":536
            },
            "Ref":{
               "type":"byte",
               "value":0
            },
            "Static":{
               "type":"byte",
               "value":1
            },
            "Tag":{
               "type":"cexostring",
               "value":"BenchPew"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"plc_bench"
            },
            "TrapDetectable":{
               "type":"byte",
               "value":1
            },
            "TrapDetectDC":{
               "type":"byte",
               "value":0
            },
            "TrapDisarmable":{
               "type":"byte",
               "value":1
            },
            "TrapFlag":{
               "type":"byte",
               "value":0
            },
            "TrapOneShot":{
               "type":"byte",
               "value":1
            },
            "TrapType":{
               "type":"byte",
               "value":0
            },
            "Type":{
               "type":"byte",
               "value":0
            },
            "Useable":{
               "type":"byte",
               "value":0
            },
            "Will":{
               "type":"byte",
               "value":0
            },
            "X":{
               "type":"float",
               "value":13.30000019073486
            },
            "Y":{
               "type":"float",
               "value":16.14999961853027
            },
            "Z":{
               "type":"float",
               "value":0.0
            }
         },
         {
            "__struct_id":9,
            "AnimationState":{
               "type":"byte",
               "value":0
            },
            "Appearance":{
               "type":"dword",
               "value":178
            },
            "AutoRemoveKey":{
               "type":"byte",
               "value":0
            },
            "Bearing":{
               "type":"float",
               "value":-0.0
            },
            "BodyBag":{
               "type":"byte",
               "value":0
            },
            "CloseLockDC":{
               "type":"byte",
               "value":0
            },
            "Conversation":{
               "type":"resref",
               "value":""
            },
            "CurrentHP":{
               "type":"short",
               "value":15
            },
            "Description":{
               "id":14559,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "DisarmDC":{
               "type":"byte",
               "value":15
            },
            "Faction":{
               "type":"dword",
               "value":1
            },
            "Fort":{
               "type":"byte",
               "value":16
            },
            "Hardness":{
               "type":"byte",
               "value":5
            },
            "HasInventory":{
               "type":"byte",
               "value":0
            },
            "HP":{
               "type":"short",
               "value":15
            },
            "Interruptable":{
               "type":"byte",
               "value":1
            },
            "KeyName":{
               "type":"cexostring",
               "value":""
            },
            "KeyRequired":{
               "type":"byte",
               "value":0
            },
            "Lockable":{
               "type":"byte",
               "value":0
            },
            "Locked":{
               "type":"byte",
               "value":0
            },
            "LocName":{
               "id":5821,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "OnClick":{
               "type":"resref",
               "value":""
            },
            "OnClosed":{
               "type":"resref",
               "value":""
            },
            "OnDamaged":{
               "type":"resref",
               "value":""
            },
            "OnDeath":{
               "type":"resref",
               "value":""
            },
            "OnDisarm":{
               "type":"resref",
               "value":""
            },
            "OnHeartbeat":{
               "type":"resref",
               "value":""
            },
            "OnInvDisturbed":{
               "type":"resref",
               "value":""
            },
            "OnLock":{
               "type":"resref",
               "value":""
            },
            "OnMeleeAttacked":{
               "type":"resref",
               "value":""
            },
            "OnOpen":{
               "type":"resref",
               "value":""
            },
            "OnSpellCastAt":{
               "type":"resref",
               "value":""
            },
            "OnTrapTriggered":{
               "type":"resref",
               "value":""
            },
            "OnUnlock":{
               "type":"resref",
               "value":""
            },
            "OnUsed":{
               "type":"resref",
               "value":""
            },
            "OnUserDefined":{
               "type":"resref",
               "value":""
            },
            "OpenLockDC":{
               "type":"byte",
               "value":18
            },
            "Plot":{
               "type":"byte",
               "value":0
            },
            "PortraitId":{
               "type":"word",
               "value":536
            },
            "Ref":{
               "type":"byte",
               "value":0
            },
            "Static":{
               "type":"byte",
               "value":1
            },
            "Tag":{
               "type":"cexostring",
               "value":"BenchPew"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"plc_bench"
            },
            "TrapDetectable":{
               "type":"byte",
               "value":1
            },
            "TrapDetectDC":{
               "type":"byte",
               "value":0
            },
            "TrapDisarmable":{
               "type":"byte",
               "value":1
            },
            "TrapFlag":{
               "type":"byte",
               "value":0
            },
            "TrapOneShot":{
               "type":"byte",
               "value":1
            },
            "TrapType":{
               "type":"byte",
               "value":0
            },
            "Type":{
               "type":"byte",
               "value":0
            },
            "Useable":{
               "type":"byte",
               "value":0
            },
            "Will":{
               "type":"byte",
               "value":0
            },
            "X":{
               "type":"float",
               "value":16.70000076293945
            },
            "Y":{
               "type":"float",
               "value":16.14999961853027
            },
            "Z":{
               "type":"float",
               "value":0.0
            }
         },
         {
            "__struct_id":9,
            "AnimationState":{
               "type":"byte",
               "value":0
            },
            "Appearance":{
               "type":"dword",
               "value":178
            },
            "AutoRemoveKey":{
               "type":"byte",
               "value":0
            },
            "Bearing":{
               "type":"float",
               "value":-0.0
            },
            "BodyBag":{
               "type":"byte",
               "value":0
            },
            "CloseLockDC":{
               "type":"byte",
               "value":0
            },
            "Conversation":{
               "type":"resref",
               "value":""
            },
            "CurrentHP":{
               "type":"short",
               "value":15
            },
            "Description":{
               "id":14559,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "DisarmDC":{
               "type":"byte",
               "value":15
            },
            "Faction":{
               "type":"dword",
               "value":1
            },
            "Fort":{
               "type":"byte",
               "value":16
            },
            "Hardness":{
               "type":"byte",
               "value":5
            },
            "HasInventory":{
               "type":"byte",
               "value":0
            },
            "HP":{
               "type":"short",
               "value":15
            },
            "Interruptable":{
               "type":"byte",
               "value":1
            },
            "KeyName":{
               "type":"cexostring",
               "value":""
            },
            "KeyRequired":{
               "type":"byte",
               "value":0
            },
            "Lockable":{
               "type":"byte",
               "value":0
            },
            "Locked":{
               "type":"byte",
               "value":0
            },
            "LocName":{
               "id":5821,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "OnClick":{
               "type":"resref",
               "value":""
            },
            "OnClosed":{
               "type":"resref",
               "value":""
            },
            "OnDamaged":{
               "type":"resref",
               "value":""
            },
            "OnDeath":{
               "type":"resref",
               "value":""
            },
            "OnDisarm":{
               "type":"resref",
               "value":""
            },
            "OnHeartbeat":{
               "type":"resref",
               "value":""
            },
            "OnInvDisturbed":{
               "type":"resref",
               "value":""
            },
            "OnLock":{
               "type":"resref",
               "value":""
            },
            "OnMeleeAttacked":{
               "type":"resref",
               "value":""
            },
            "OnOpen":{
               "type":"resref",
               "value":""
            },
            "OnSpellCastAt":{
               "type":"resref",
               "value":""
            },
            "OnTrapTriggered":{
               "type":"resref",
               "value":""
            },
            "OnUnlock":{
               "type":"resref",
               "value":""
            },
            "OnUsed":{
               "type":"resref",
               "value":""
            },
            "OnUserDefined":{
               "type":"resref",
               "value":""
            },
            "OpenLockDC":{
               "type":"byte",
               "value":18
            },
            "Plot":{
               "type":"byte",
               "value":0
            },
            "PortraitId":{
               "type":"word",
               "value":536
            },
            "Ref":{
               "type":"byte",
               "value":0
            },
            "Static":{
               "type":"byte",
               "value":1
            },
            "Tag":{
               "type":"cexostring",
               "value":"BenchPew"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"plc_bench"
            },
            "TrapDetectable":{
               "type":"byte",
               "value":1
            },
            "TrapDetectDC":{
               "type":"byte",
               "value":0
            },
            "TrapDisarmable":{
               "type":"byte",
               "value":1
            },
            "TrapFlag":{
               "type":"byte",
               "value":0
            },
            "TrapOneShot":{
               "type":"byte",
               "value":1
            },
            "TrapType":{
               "type":"byte",
               "value":0
            },
            "Type":{
               "type":"byte",
               "value":0
            },
            "Useable":{
               "type":"byte",
               "value":0
            },
            "Will":{
               "type":"byte",
               "value":0
            },
            "X":{
               "type":"float",
               "value":16.70000076293945
            },
            "Y":{
               "type":"float",
               "value":14.5
            },
            "Z":{
               "type":"float",
               "value":0.0
            }
         },
         {
            "__struct_id":9,
            "AnimationState":{
               "type":"byte",
               "value":0
            },
            "Appearance":{
               "type":"dword",
               "value":178
            },
            "AutoRemoveKey":{
               "type":"byte",
               "value":0
            },
            "Bearing":{
               "type":"float",
               "value":-0.0
            },
            "BodyBag":{
               "type":"byte",
               "value":0
            },
            "CloseLockDC":{
               "type":"byte",
               "value":0
            },
            "Conversation":{
               "type":"resref",
               "value":""
            },
            "CurrentHP":{
               "type":"short",
               "value":15
            },
            "Description":{
               "id":14559,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "DisarmDC":{
               "type":"byte",
               "value":15
            },
            "Faction":{
               "type":"dword",
               "value":1
            },
            "Fort":{
               "type":"byte",
               "value":16
            },
            "Hardness":{
               "type":"byte",
               "value":5
            },
            "HasInventory":{
               "type":"byte",
               "value":0
            },
            "HP":{
               "type":"short",
               "value":15
            },
            "Interruptable":{
               "type":"byte",
               "value":1
            },
            "KeyName":{
               "type":"cexostring",
               "value":""
            },
            "KeyRequired":{
               "type":"byte",
               "value":0
            },
            "Lockable":{
               "type":"byte",
               "value":0
            },
            "Locked":{
               "type":"byte",
               "value":0
            },
            "LocName":{
               "id":5821,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "OnClick":{
               "type":"resref",
               "value":""
            },
            "OnClosed":{
               "type":"resref",
               "value":""
            },
            "OnDamaged":{
               "type":"resref",
               "value":""
            },
            "OnDeath":{
               "type":"resref",
               "value":""
            },
            "OnDisarm":{
               "type":"resref",
               "value":""
            },
            "OnHeartbeat":{
               "type":"resref",
               "value":""
            },
            "OnInvDisturbed":{
               "type":"resref",
               "value":""
            },
            "OnLock":{
               "type":"resref",
               "value":""
            },
            "OnMeleeAttacked":{
               "type":"resref",
               "value":""
            },
            "OnOpen":{
               "type":"resref",
               "value":""
            },
            "OnSpellCastAt":{
               "type":"resref",
               "value":""
            },
            "OnTrapTriggered":{
               "type":"resref",
               "value":""
            },
            "OnUnlock":{
               "type":"resref",
               "value":""
            },
            "OnUsed":{
               "type":"resref",
               "value":""
            },
            "OnUserDefined":{
               "type":"resref",
               "value":""
            },
            "OpenLockDC":{
               "type":"byte",
               "value":18
            },
            "Plot":{
               "type":"byte",
               "value":0
            },
            "PortraitId":{
               "type":"word",
               "value":536
            },
            "Ref":{
               "type":"byte",
               "value":0
            },
            "Static":{
               "type":"byte",
               "value":1
            },
            "Tag":{
               "type":"cexostring",
               "value":"BenchPew"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"plc_bench"
            },
            "TrapDetectable":{
               "type":"byte",
               "value":1
            },
            "TrapDetectDC":{
               "type":"byte",
               "value":0
            },
            "TrapDisarmable":{
               "type":"byte",
               "value":1
            },
            "TrapFlag":{
               "type":"byte",
               "value":0
            },
            "TrapOneShot":{
               "type":"byte",
               "value":1
            },
            "TrapType":{
               "type":"byte",
               "value":0
            },
            "Type":{
               "type":"byte",
               "value":0
            },
            "Useable":{
               "type":"byte",
               "value":0
            },
            "Will":{
               "type":"byte",
               "value":0
            },
            "X":{
               "type":"float",
               "value":13.30000019073486
            },
            "Y":{
               "type":"float",
               "value":14.5
            },
            "Z":{
               "type":"float",
               "value":0.0
            }
         },
         {
            "__struct_id":9,
            "AnimationState":{
               "type":"byte",
               "value":0
            },
            "Appearance":{
               "type":"dword",
               "value":287
            },
            "AutoRemoveKey":{
               "type":"byte",
               "value":0
            },
            "Bearing":{
               "type":"float",
               "value":-0.0
            },
            "BodyBag":{
               "type":"byte",
               "value":0
            },
            "CloseLockDC":{
               "type":"byte",
               "value":0
            },
            "Conversation":{
               "type":"resref",
               "value":""
            },
            "CurrentHP":{
               "type":"short",
               "value":15
            },
            "Description":{
               "id":68858,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "DisarmDC":{
               "type":"byte",
               "value":15
            },
            "Faction":{
               "type":"dword",
               "value":4294967295
            },
            "Fort":{
               "type":"byte",
               "value":16
            },
            "Hardness":{
               "type":"byte",
               "value":5
            },
            "HasInventory":{
               "type":"byte",
               "value":0
            },
            "HP":{
               "type":"short",
               "value":15
            },
            "Interruptable":{
               "type":"byte",
               "value":1
            },
            "KeyName":{
               "type":"cexostring",
               "value":""
            },
            "KeyRequired":{
               "type":"byte",
               "value":0
            },
            "Lockable":{
               "type":"byte",
               "value":0
            },
            "Locked":{
               "type":"byte",
               "value":0
            },
            "LocName":{
               "id":68857,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "OnClick":{
               "type":"resref",
               "value":""
            },
            "OnClosed":{
               "type":"resref",
               "value":""
            },
            "OnDamaged":{
               "type":"resref",
               "value":""
            },
            "OnDeath":{
               "type":"resref",
               "value":""
            },
            "OnDisarm":{
               "type":"resref",
               "value":""
            },
            "OnHeartbeat":{
               "type":"resref",
               "value":""
            },
            "OnInvDisturbed":{
               "type":"resref",
               "value":""
            },
            "OnLock":{
               "type":"resref",
               "value":""
            },
            "OnMeleeAttacked":{
               "type":"resref",
               "value":""
            },
            "OnOpen":{
               "type":"resref",
               "value":""
            },
            "OnSpellCastAt":{
               "type":"resref",
               "value":""
            },
            "OnTrapTriggered":{
               "type":"resref",
               "value":""
            },
            "OnUnlock":{
               "type":"resref",
               "value":""
            },
            "OnUsed":{
               "type":"resref",
               "value":""
            },
            "OnUserDefined":{
               "type":"resref",
               "value":""
            },
            "OpenLockDC":{
               "type":"byte",
               "value":18
            },
            "Plot":{
               "type":"byte",
               "value":0
            },
            "PortraitId":{
               "type":"word",
               "value":0
            },
            "Ref":{
               "type":"byte",
               "value":0
            },
            "Static":{
               "type":"byte",
               "value":1
            },
            "Tag":{
               "type":"cexostring",
               "value":"x0_largebench"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"x0_largebench"
            },
            "TrapDetectable":{
               "type":"byte",
               "value":1
            },
            "TrapDetectDC":{
               "type":"byte",
               "value":0
            },
            "TrapDisarmable":{
               "type":"byte",
               "value":1
            },
            "TrapFlag":{
               "type":"byte",
               "value":0
            },
            "TrapOneShot":{
               "type":"byte",
               "value":1
            },
            "TrapType":{
               "type":"byte",
               "value":0
            },
            "Type":{
               "type":"byte",
               "value":0
            },
            "Useable":{
               "type":"byte",
               "value":0
            },
            "Will":{
               "type":"byte",
               "value":0
            },
            "X":{
               "type":"float",
               "value":15.0
            },
            "Y":{
               "type":"float",
               "value":18.25
            },
            "Z":{
               "type":"float",
               "value":0.0
            }
         }
      ]
   },
   "SoundList":{
      "type":"list",
      "value":[
         
      ]
   },
   "StoreList":{
      "type":"list",
      "value":[
         
      ]
   },
   "TriggerList":{
      "type":"list",
      "value":[
         
      ]
   },
   "WaypointList":{
      "type":"list",
      "value":[
         {
            "__struct_id":5,
            "Appearance":{
               "type":"byte",
               "value":1
            },
            "Description":{
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "HasMapNote":{
               "type":"byte",
               "value":0
            },
            "LinkedTo":{
               "type":"cexostring",
               "value":""
            },
            "LocalizedName":{
               "id":14817,
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "MapNote":{
               "type":"cexolocstring",
               "value":{
                  
               }
            },
            "MapNoteEnabled":{
               "type":"byte",
               "value":1
            },
            "Tag":{
               "type":"cexostring",
               "value":"hw_travshop001"
            },
            "TemplateResRef":{
               "type":"resref",
               "value":"nw_waypoint001"
            },
            "XOrientation":{
               "type":"float",
               "value":-1.0
            },
            "XPosition":{
               "type":"float",
               "value":13.5
            },
            "YOrientation":{
               "type":"float",
               "value":2.102055759678478e-006
            },
            "YPosition":{
               "type":"float",
               "value":15.39999961853027
            },
            "ZPosition":{
               "type":"float",
               "value":-5.7220458984375e-006
            }
         }
      ]
   }
}
Und die Schlüsselwerte ergeben sich aus der Staffelung der Schlüssel der jeweiligen ineinander gekapselten (assoziativen) Arrays.


txt = {"__data_type":"GIT ","AreaProperties":{"__struct_id":100,"type":"struct","value":{"__struct_id":100,"AmbientSndDay":{"type":"int","value":31},"AmbientSndDayVol":{"type":"int","value":32},"AmbientSndNight":{"type":"int","value":31},"AmbientSndNitVol":{"type":"int","value":32},"EnvAudio":{"type":"int","value":0},"MusicBattle":{"type":"int","value":34},"MusicDay":{"type":"int","value":20},"MusicDelay":{"type":"int","value":90000},"MusicNight":{"type":"int","value":20}}}}

obj:= JSON.Load(txt)
MsgBox % obj.AreaProperties.value.AmbientSndDay.type - Ergebnis int


wirthts
Posts: 6
Joined: 24 Apr 2019, 05:00
Contact:

Re: Übertragen eines Json-Strings in eine TreeView funktioniert nur teilweise (AHK 1.1.33.6)

Post by wirthts » 31 Mar 2021, 14:25

@BoBo Danke das hilft mir schon etwas weiter. Ich hatte mir die assoziativen Arrays auch angesehen, aber auf den ersten Blick nicht wirklich viel daraus verstanden... Mir fehlte das richtige Beispiel dafür und auch passend für mein Skript das irgendwie umzusetzen.

Da ich jetzt vorbestimmte obere Bereiche des Arrays haben will, habe ich die Auswertung etwas angepasst. Wobei ich in "var" den ausgewählten Inhalt der DropDownList als oberen Bereich eingespeichert habe.

Code: Select all

MsgBox % obj[var]["value"]["AmbientSndDay"]["type"]
Das ist jetzt eine statische Rückmeldung. Wie bekomme ich aber nun die Daten unter zB. "AreaProperties" in die TreeView, ohne für jeden Wert alle Befehle einzeln zu schreiben? Da die Schlüsselwerte in ein paar Bereichen abweichen würde dies das Skript aufplustern, was ich aber vermeiden wollte. Deswegen habe ich mich mit einer for-Schleife (ist das nun der richtige Begriff für AHK?) weiter voran getastet. So habe ich die ersten Indexe und Werte ohne Probleme bekommen.

Code: Select all

Pa := TV_Add(var)
for index, wert in c
{
  Ch := TV_Add(index, Pa)
        TV_Add(wert,  Ch)
}
Sobald ich dann aber in den "value"-Bereich kam, wo mir AHK dann eigentlich in den nächst tieferen Bereich wechseln sollte, zB. dann "__struct_id" mit "100", "AmbientSndDay" mit den Childs anlegen sollte, war schon finito. Ich versuch das hier mal zeichnerisch darzustellen....

Code: Select all

+ AreaProperties
 + __struct_id
    |_ 100
 + type
    |_ struct
 + value
    |_ 
So sollte es eigentlich aussehen:

Code: Select all

+ AreaProperties
 + __struct_id
    |_ 100
 + type
    |_ struct
 + value
    + struct_id
      |_ 100
    + AmbientSndDay
      + type
        |_int
      + value
        |_ 31
    + AmbientSndDayVol
      + type
        |_ int
      + value
        |_ 32
    ...
Ich weiß jetzt nicht ob ich mich verständlich ausdrücke...

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Übertragen eines Json-Strings in eine TreeView funktioniert nur teilweise (AHK 1.1.33.6)

Post by BoBo » 31 Mar 2021, 16:03

Habe zwztl. mal dein JSON abgespeckt um es etwas übersichtlicher/verständlicher zu halten.
Es sind nicht wenige Schlüssel ohne Wert gesetzt, da wird es schwierig in einer MsgBox etwas sichtbares aufzuzeigen.
(M)ein Verdacht, dir bereitet die Mischung aus assoziativen {"key":"val"} und einfachen arrays ["val",val,"val"] Probleme.
Tröste dich, you're not alone :shh:
Frage: coloriert dein Editor die Klammerpaare?

Code: Select all

;	https://jsonformatter.curiousconcept.com/#

#Include JSON.ahk

txt =
(Join
	{
   	"AreaProperties":
		{"value":
			{"AmbientSndDay":
				{"type":"int","value":31}
			}
		},
	"Creature List":
		{"type":"list","value":[]},
	"Door List":
		{"value":	
			[
				{
					"AnimationState":
						{"type":"byte","value":0},
					"Appearance":
						{"type":"dword","value":0},
            		"AutoRemoveKey":
						{"type":"byte","value":0},
		        	"Bearing":
						{"type":"float","value":-0.0},
 		         	"CloseLockDC":
						{"type":"byte","value":0},
            		"Conversation":
						{"type":"resref","value":""}
				}
			]
		   },
	"Encounter List":
		{"type":"list","value":[]},
   	"List":
		{"type":"list","value":[]},
   	"Placeable List":
		{"value":
			[
			        {
					"AnimationState":
						{"value":0},
            		"Appearance":
						{"type":"dword","value":178},
            		"AutoRemoveKey":
						{"value":0},
            		"Bearing":{"type":"float"}
					}
			]
   		},
	"SoundList":
		{"value":[]},
	"StoreList":
		{"value":[]},
  	"TriggerList":
		{"value":[]},
	"WaypointList":
		{"value":
				[
				      {													
						"Appearance": 
							{"value":1},
						"Description":
							{"type":"cexolocstring","value":
								{"type":"BoBo"}
							},
				       "HasMapNote":
							{"type":"byte"}
					}
				]
		}

	}
)

obj := JSON.Load(txt)
MsgBox % obj.Door List.value[1].Conversation.type			; nicht getestet, sollte 'resref' anzeigen ?
MsgBox % obj.WayPointList.value[1].Description.type			; cexolocstring
MsgBox % obj.WayPointList.value[1].Description.value.type	; BoBo
MsgBox % obj.WayPointList.value[1].HasMapNote.type			; byte
HTH.

wirthts
Posts: 6
Joined: 24 Apr 2019, 05:00
Contact:

Re: Übertragen eines Json-Strings in eine TreeView funktioniert nur teilweise (AHK 1.1.33.6)

Post by wirthts » 01 Apr 2021, 01:39

@Bobo Puh, dann bin ich ja froh, dass es nicht nur mir so gehen kann. Ich habe auch die Möglichkeit das so schön aufgesplittet darzustellen, was ich dann meist als Anzeige in meinem Editor nutze. Und um nun zu deiner Frage zu kommen: Ich nutze NotePad++ (mit der UDL und Syntax für AHK) welcher mir die Json-Datei automatisch auch einfärbt.

Die 'nicht wenigen Schlüssel ohne Wert' sind normal, da es in diesen Abschnitten des Json auch keine Daten gab. In meinem ersten Post hatte ich gleich das Json unverändert eingefügt, so dass man gleich merkt, mit was für einen "Datenschatz" ich versuche zu arbeiten... Deswegen habe ich meist beim Auswählen übers DDL immer die Bereiche genommen, die Daten enthielten, wie "AreaProperties" oder "Door List" usw.
Ich habe mal dein Skript getestet und das funkt, ein bisschen umgeschrieben, auch mit einer der Json-Dateien.

Post Reply

Return to “Spiele”