每个对象代表不同的用户,每个用户有3个属性:loginid,password,realname。
以下是我所写的内容。这条线是否正确?
var user= [
{"loginid":"email1@email.com", "password":1234, "realname":"A" };,
{"loginid":"email2@email.com", "password":1234, "realname":"B" };,
{"loginid":"email3@email.com", "password":1234, "realname":"C" };,
]
答案 0 :(得分:0)
这是正确的,除了分号。
编辑: 实际上,我认为正确的方法是
{ "users": [
{"loginid":"email1@email.com", "password":1234, "realname":"A" },
{"loginid":"email2@email.com", "password":1234, "realname":"B" },
{"loginid":"email3@email.com", "password":1234, "realname":"C" },
]
}
答案 1 :(得分:0)
var user= [
{loginid:"email1@email.com", password:1234, realname:"A" },
{loginid:"email2@email.com", password:1234, realname:"B" },
{loginid:"email3@email.com", password:1234, realname:"C" },
]
答案 2 :(得分:0)
我相信这就是你想要的:
var user= [
{loginid:"email1@email.com", password:1234, realname:"A"},
{loginid:"email2@email.com", password:1234, realname:"B"},
{loginid:"email3@email.com", password:1234, realname:"C"},
];
答案 3 :(得分:0)
这就是你如何创建数组对象JSON
{
"user": [{
"loginid": "email1@email.com",
"password": 1234,
"realname": "A"
},
{
"loginid": "email2@email.com",
"password": 1234,
"realname": "B"
},
{
"loginid": "email3@email.com",
"password": 1234,
"realname": "C"
}
]
}