Daron
Daron

Reputation: 329

JSON Object Holding a JSON Array?

Can a JSON object hold a JSON array as is shown in the following code?

courseJSONObject.put( "students", studentJSONArray );

Upvotes: 0

Views: 507

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1075209

Yes, it looks like this:

{
    "students": []
}

For example, here's an object with a students array containing the entries 1, 2, and 3:

{
    "students": [1, 2, 3]
}

More in the documentation and the RFC.

Upvotes: 1

Related Questions