I'm calling a json string that has white spaces in the its identifiers which is causing my code to break. I'd like to call the first name and last name
var names = jQuery.parseJSON('[{"F name":"Chris1","Lname":"Test1"},
{"F name":"Chirs2 ","Lname":"Test2"},{"F name":"Chris3","Lname":"Test3"}]');
//This outputs **First Name: undefined**
document.getElementById("demo").innerHTML=('First Name: '+names[1].Fname+'\n
\n <br/>Last Name: '+names[1].Lname+'');
//This outputs nothing
document.getElementById("demo").innerHTML=('First Name: '+names[1].["F name"]+
'\n \n <br/>Last Name: '+names[1].Lname+'');
I know the naming sucks, and it should not have a space like "F name" but its not my original data so I have to use the naming convention. Do you know the correct syntax to display the first name in this array?
Thanks for your help!