GMS 2.3+ JSON with Structs in 2.3.1


Now that we can load json data as structs and arrays, I have a question. I can take the following data and load it in:

    "Some Data" : "Hello World",
    "Some More Data" : "Goodbye"   
And that will give me a struct with two variables containing the strings hello world and goodbye. However, what are the names of those variables? And can you access them using the normal struct . accessor? I've inspected it in the debugger and it shows the struct variable name as Some Data (which of course doesn't follow normal variable naming rules as it allows a space).

I can access these variables using the $ accessor because then you can do something like my_data[$ "Some Data"]. Is this the only way to do so? What's going on under the hood here? (I know we probably don't know that for GM but it seems like other languages would have this issue as well.)


My gut instinct is to think of it as a map with a lookup table with an arbitrary key more or less. The fact you can use dot notation for certain keys could be viewed as syntactic sugar. Going further our of my depth, I seem to remember the attributes of a struct being defined in code being implemented differently than dynamically assigned attributes, which would be stored in some map structure.