what is the purpose of using square brackets in json?

The square brackets produce a list/array.

The curly brackets produce an object with key/value pairs.

The list can then be a value of a key/value pair.


[] means an array of object (a list) and {} means it will be an object.

Example:

{
    "ID":"test",
    "sports": [
        "volley-ball",
        "badminton"
    ]
}

To get the ID, you can do: myjsonobject.ID (here you will get "test")

And for sports: myjsonobject.sports[0] (here you will get "volley-ball")