[
{
"s.no":0,
"amt.pledged":15823,
"blurb":"'Catalysts, Explorers & Secret Keepers: Women of Science Fiction' is a take-home exhibit & anthology by the Museum of Science Fiction.",
"by":"Museum of Science Fiction",
"country":"US",
我想访问一个json对象的元素,其中键包含'。'在Javascript In this image the "s.no" contains '.' so how can i access the value of "s.no"
中答案 0 :(得分:1)
您可以在解析后使用myObj["s.no"]
。
答案 1 :(得分:0)
使用方括号([]
),如下所示:
var data = [{
"s.no":0,
"amt.pledged":15823,
"blurb":"'Catalysts, Explorers & Secret Keepers: Women of Science Fiction' is a take-home exhibit & anthology by the Museum of Science Fiction.",
"by":"Museum of Science Fiction",
"country":"US"
}];
var slNo = data[0]["s.no"];
console.log(slNo);