tags:

views:

16

answers:

2

Hello,

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 "Department". 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!

A: 

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

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

hope that helps.

Here Be Wolves
A: 

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.

Guffa