什么是使用JSON数组VS JSON对象之间的差异? [英] What are the differences between using JSON arrays vs JSON objects?
问题描述
什么是使用JSON阵列的区别和优势:
{
事情:[
{},
{}
]
}
与JSON对象:
{
事情:{
{},
{}
}
}
不是听起来像一个聪明的驴子,但远...
在阵列
和对象的区别
。
对象都设置使用键
和值
像...
person.age = 15;
如果在键
值是一个变量,那么可以访问它像...
VAR键=年龄;
警报(人[关键]);
阵列,可以使用一个整数[1]指标,并采取一个值。
播放器[1] .score + = 1000;
[1]是的,我知道... JavaScript中的整数索引真的变成了幕后的字符串。忽略。想取一个整数数组尤其是当你觉得JSON的。
What are the difference and advantages of using JSON arrays:
{
thing:[
{ },
{ }
]
}
versus JSON objects:
{
thing:{
{ },
{ }
}
}
Not to sound like a smart ass, but well...
The difference between an array
and an object
.
Objects are set up using a key
and value
like...
person.age = 15;
If the key
value is a variable, then one could access it like...
var key = "age";
alert(person[key]);
Arrays use an integer[1] index and take a value.
player[1].score += 1000;
[1] Yes, I know ... in Javascript the integer index is really turned into a string behind the scenes. Ignore that. Think of arrays taking an integer value ESPECIALLY when you think of JSON.
这篇关于什么是使用JSON数组VS JSON对象之间的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!