Question: JavaScript code below: records are serialized JSON data. I can access it directly from JavaScript using, for example, a
warning (records.data [0] .phone);
The problem is that some bright spark used spaces in FirstName and LastName, which means that I will need to access it, such as alert (records.data [0]. Last Name);
Which, of course, is impossible. Is there a way to access this space, for example, an escape sequence? I already tried to skip the space or replace it with an underscore. The problem is that I am getting a recording and I have no control over the source code.
var records = {
"data" : [
{
"First Name" : "John",
"Last Name" : "Doe",
"Email" : "nobody@example.com",
"Phone" : "(917) 41-6598",
},
{
"First Name" : "Thomas",
"Last Name" : "Brown",
"Email" : "somebody@example.com",
"Phone" : "(917) 41-2892",
},
{
"First Name" : "Albert",
"Last Name" : "Hansen",
"Email" : "someone@example.com",
"Phone" : "(917) 41-3769",
}
]};
alert(records.data[0].Email);
alert(records.data[0].Phone);