From the course: Learn API Documentation with JSON and XML

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Documenting nested JSON responses

Documenting nested JSON responses

From the course: Learn API Documentation with JSON and XML

Start my 1-month free trial

Documenting nested JSON responses

- [Instructor] Now let's look at more complex JSON files that use nested data. Most JSON files have some level of nesting. This means that objects will include arrays or other objects, and arrays can include objects or other arrays. So for example, if we took our simple example from earlier, and wrapped all the data in an employee object, it would look like this. This object has two levels of nesting. In our tables, we need to indicate how various objects fit inside each other. There are basically two ways to handle documentation to indicate nesting. One is to use indentation, where each indent indicates a level of nesting. This is best to use when objects are not reused much. If you have a situation where you're going to be reusing the same object type in several different tables, you may want to have a table for each type of object. This way you can link to the tables and avoid duplication. The only disadvantage of this is that it tends to take up more space. Here's the example I…

Contents