JSON语法:传输数组 [英] JSON Syntax: Transmitting an array
本文介绍了JSON语法:传输数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有效 JSON语法属于此类:
A valid JSON Syntax is something of the kind:
{
"username": "admin",
"password": "123"
}
但是,如果我想传输一个用户"数组(给出示例),而不是单个用户",怎么办?
But what if I want to transmit an array of 'users' (given the example), instead of a single 'user' ?
根据规范,代码是否在有效JSON以下?
Is the code below Valid JSON, according to the specifications?
[{
"username": "admin",
"password": "123"
}, {
"username": "bbvb",
"password": "sdfsdf"
}, {
"username": "asd",
"password": "222"
}]
如果没有,那么通过JSON传输值数组的最佳方法是什么? (用最好的方式",我的意思是语法)
And if not, what is the best way to transmit an array of values across with JSON? (And with 'best way', I mean syntactically)
推荐答案
是的,您的示例是有效的JSON-这正是您要使用数组的方式.
Yes, your example is valid JSON - that is exactly how you want to use an array.
这篇关于JSON语法:传输数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文