expand arrays

Aarcanist1/1/2022
Is there a way to expandObject except for an Array?
Aarcanist1/1/2022
My Form Data
{
    "modes.0.0": "none",
    "modes.0.1": "",
    "modes.1.0": "initiative",
    "modes.1.1": "initiative",
    "modes.2.0": "name",
    "modes.2.1": "name",
    "modes.3.0": "selection",
    "modes.3.1": "data.flags.ctg.group",
    "modes.4.0": "players",
    "modes.4.1": "players.*.id",
    "modes.5.0": "actor",
    "modes.5.1": "data.actorId",
    "modes.6.0": "mob",
    "modes.6.1": ""
}
Aarcanist1/1/2022
Desired output:
[
    ["none", ""],
    ["initiative", "initiative"],
    ["name", "name"],
    ["selection", "data.flags.ctg.group"],
    ["players", "players.*.id"],
    ["actor", "data.actorId"],
    ["mob", ""]
]
Aarcanist1/1/2022
I'm interested in hearing less messy solutions, but this seems to work:
Object.values(expandObject(temp1)).map(o => Object.values(o).map(o => Object.values(o)))[0]
MMana1/2/2022
There's no way to identify arrays in that, so there probably are no good methods.
CCalego1/2/2022
I thought the foundry default expand object does this
CCalego1/2/2022
At least when my form data has keys with 0s and such like that it shows up as arrays
Aarcanist1/2/2022
It looks like this for me:
{
    "modes": {
        "0": {
            "0": "none",
            "1": ""
        },
        "1": {
            "0": "initiative",
            "1": "initiative"
        },
        "2": {
            "0": "name",
            "1": "name"
        },
        "3": {
            "0": "selection",
            "1": "data.flags.ctg.group"
        },
        "4": {
            "0": "players",
            "1": "players.*.id"
        },
        "5": {
            "0": "actor",
            "1": "data.actorId"
        }
    }
}
UUUnknown User1/2/2022
Message Not Public
Sign In & Join Server To View
Aarcanist1/2/2022
I need it to be an actual array because I need it to work with the Array push/pop/filter/unshift/etc. methods
UUUnknown User1/2/2022
2 Messages Not Public
Sign In & Join Server To View
CCalego1/2/2022
Ohhhh that's what I did now I remember
CCalego1/2/2022
@arcanist there's a method you can override in formapplication that isn't _updateObject which manipulates the form values provided to updateObject: _getSubmitData
CCalego1/2/2022
so i'd recommend doing whatever you come up with in there