How to turn a json into a struct

I am used to use ds_maps when handling data but I want to switch to use structs.
Usually I have an object "oData" which contains all the ds_maps.
e.g. in the create event of the a I have a script like the following one executed which returns a ds_map and saves its ID in a variable.
GML:
function getDataUnits(){
    return json_decode(@'
    {
       "knight" : {
            "name"                : "Knight",
            "hitpoints"            : 2,
            "initiative"        : 1,
            "portrait"            : "sKnightPortrait",
            "spriteIdle"        : "sKnightMid",
            "actions"            : ["action"]
        },

       "villager" : {
            "name"                : "Villager",
            "hitpoints"            : 1,
            "initiative"        : 1,
            "portrait"            : "sVillagerPortrait",
            "spriteIdle"        : "sVillagerMid",
            "actions"            : ["poison"]
        }
    }');
}
Code:
//oData create Event
dsm_units = getDataUnits();
How would I do this with structs?
GML:
function getStructUnits() constructor {

       knight : {

            name        : "Knight",
            hitpoints    : 2,
            initiative    : 1,
            portrait    : "sKnightPortrait",
            spriteIdle    : "sKnightMid",
            actions        : ["action"]

        },

        villager : {

            name            : "Villager",
            hitpoints        : 1,
            initiative        : 1,
            portrait        : "sVillagerPortrait",
            spriteIdle      : "sVillagerMid",
            actions         : ["poison"]

        }
and then in oData
GML:
strct_units = new getStructUnits();
Is this correct?
 
Top