The strelok2010 comment above should work, although it depends on whether your result will really look like the one at the top of your question.
javascript-, JSON. (, , , .) , , result javascript JSON. , , result javascript-, javascript. . , .
, .
, . . .
var result = [{"name": "Jason"
"date of birth": "february 23, 2985"
....
}];
var firstResultsName = result[0].name;
, - .
name N , n .
, javascript.
-, , .
, , . , , , .
, javascript. , (, , -, JavaScript), , . , , , , .
" " (, " " - , , .) ( //)
, " "
var people = [
{
"name": "Bob",
"occupation": "Architect",
"date of birth": "01/23/83"
},
{
"name": "Timothy",
"Occupation": "Accountant",
"date of birth": "02/23/78"
}
];
, .
[
{
"name": "Bob",
"occupation": "Architect",
"date of birth": "01/23/83"
},
{
"name": "Timothy",
"Occupation": "Accountant",
"date of birth": "02/23/78"
}
]
" ", , . . , , , ,
var array = ["foo", "bar", "baz"];
array[0]
["foo", "bar", "baz"][2]
. people .
var person = people[0];
, ,
{
"name": "Bob",
"occupation": "Architect",
"date of birth": "01/23/83"
}
, , . , . ( .)
, person, , , , " ", . <object>.<property>, " ", , . <object>.["<property>"] <object>.[<variable>]
, , , , , , "". , javascript . , javascript , JSON. , , , .
var result;
var obj = { foo: 1, Bar: 2, "foo bar": 3 };
var randomVarName = "Bar";
result = obj.foo;
result = obj[randomVarName];
result = obj["foo bar"];
. , , , .
var name = person.name;
.
"Bob"
, . , .
,
, ,
people[0].name
, ,
var result = [
{
"name": "Jason"
"date of birth": "february 23, 2985"
....
}
];
,
result[0].name
var result = {
"name": "Jason"
"date of birth": "february 23, 2985"
....
}
result.name
, date of birth , , . , . . , .
MDN:
get = object[property_name];
object[property_name] = set;
property_name - . ; > , . "1foo", "! Bar!" "" ().
, , , , , .
.
result["date of birth"]
, , . , , , :
result["name"]
, , .
var prop_name = "date of birth";
result[prop_name];
, , MDN .
, .