JSON Example

by | Dec 25, 2020 | JSON

Home » Website Development » JSON » JSON Example

JSON Example

Assignment 1: Develop a JSON Data which shows data of students from three different sections of a class. Data must include students name and their favourite subjects. Display the data in a table.

Solution: In this assignment, we will initially have a JSON with three objects (represented by {}). These objects will represent three different sections, so we will name these objects as A, B and C.

JSON Example 1

Under these objects, we will have an array. An array (represented by []) can hold multiple records. Thus, we will have multiple students record under each array.

JSON Example 2

Each individual record for a student is also unique, therefore every student information will also be represented using an object. Here, we have added only three students (objects) in each section.

JSON Example 3

If I add three students in place of three empty objects, it will look something like this:

JSON Example 4

Since, these objects represent students’ detail, therefore I named them students. Under this object, we will have another array (here, fav sub) that will represent their favourite subjects.

JSON Example 5

If we add all the subjects in the given array, fav sub. Then, it will look something like this:

JSON Example 6

Now, we will validate the above JSON code using the validator. Our JSON will produce output something like this (not exactly, we have added section to make it look better):

JSON Example Output

JSON Assignment

Assignment 2: Develop a JSON Data which shows data of 10 Employees. It will include Employee ID, Employee Name, Date of Joining and their location. The output must look something like this (but with 10 record):

JSON Assignment

Note: You can use online JSON to HTML converter to check output in the form of a table.

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Author