When parsing the below JSON data as part of a queryset, JavaScript returns “undefined” when accessing this as a recordset:
data[0].user.name.name. // undefined
However, referring to:
data[0].userkey.key // returns 12345-12345
This is my JSON Data:
data = [
{
"id": 45862,
"user": {
"id": 123,
"name": [
{
"id": 555,
"name": "username",
"modified": "2024-07-21T08:57:21.640055"
}
],
"userkey": {
"id": 1234,
"key": "12345-12345"
},
},
"date": "2024-12-18T19:57:58",
},
]
My only guess is that “name” is a reserved word. How can I escape this?
This is part of a Django REST API GET call. So I don’t want to have to restructure the database to do this, but thinking I shouldn’t need to.
Any ideas?