Record keys to array

I use the `parse` command with KVP like this

data record(str = "name=\"john\"; age=33; city=\"Atlanta\"")<br>| parse str, "KVP{LD:key'='(LONG:valueLong | STRING:valueStr)'; '?}:person"<br>

so the output will look like this

"records": [<br>  {<br>    "str": "name=\"john\"; age=33; city=\"Atlanta\"",<br>    "person": {<br>      "name": "john",<br>      "age": "33",<br>      "city": "Atlanta"<br>    }<br>  }<br>]

I would like to have only the keys of the person object, so I end up with a structure like this:

"records": [<br>  {<br>    "str": "name=\"john\"; age=33; city=\"Atlanta\"",<br>    "keys": [ "name", "age", "city" ]<br>  }<br>]

So what the Python expression list(person.keys()) would do.

Hi @michael_altenhu

You could use the array matcher to just extract the keys

data record(str = "name=\"john\"; age=33; city=\"Atlanta\"")
| parse str, """ARRAY{LD:i '=' LD (';'|' '|EOS)}{1,}:keys"""

and this would be the result

"records": [
    {
      "str": "name=\"john\"; age=33; city=\"Atlanta\"",
      "keys": [
        "name",
        " age",
        " city"
      ]
    }

Best,
Sini