开发者

Arrays of Arrays in JSON

I'm a little new to JSON syntax. I'm trying to learn it correctly. I have a scenario where I have an array of objects. Each object has two properties which themselves are arrays. The root object is called "Depar开发者_高级运维tment". Each Department has "Managers" and "Employees". At this point, I have the following, but I'm stuck:

var departments = {
  "data": [

  ]
};

Can someone point me in the right direction? Thanks!


That's not JSON, the structure you describe looks something like this in JSON:

[{"managers":["John"],"employees":["Peter","Maria"]},{"managers":["Anna"],"employees":["Philip","Jane"]}]

The root object is just an array, it doesn't have a name.


Well, here is an array of objects, each having two array properties:

[
  {prop1: [ ... ], prop2: [ ... ]},
  {prop1: [ ... ], prop2: [ ... ]}
]

hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜