Calling a JSON table with id variables that are numbers?

I am decently new to Lua, an I have been trying to work on API calling JSON tables. However, one particular JSON Table I am trying to process has identifiers that start with numbers. For example, one such table looks like this:

“data”: {
    “1001”: {
       “plaintext”: “item title”,
       “description”: “item description”,
      “id”: 1001
            }
        }

When I try to decode the json file and print “data.1001.id” to the console, for example, I keep getting an error “malformed number near ‘.1001.id’”.

I’ve looked at other similar questions on this site that say to put it in square brackets, such as “data.[1001].id” or “data.[[1001]].id”, but when I do that I get the error " ‘<name>’ expected near ‘[[1001]]’".

Any help would be appreciated

In this case you need to wrap the 1001 in “”.

data.[“1001”].id

This is, because your key into the table here actually is the string representing the number 1001 and not it’s actual integer value.

In this case you need to wrap the 1001 in “”.

data.[“1001”].id

This is, because your key into the table here actually is the string representing the number 1001 and not it’s actual integer value.