Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

json
data structures

What are JSON structures?

Educative Answers Team

JSON ( JavaScript Object Notation ) is a lightweight text-based language. The data can only be text while it is being exchanged between a browser and a server. Any JavaScript object can be converted into a JSON text.

Data structures in JSON

JSON supports these two data structures:

svg viewer

A JSON can store several types of values, listed in the table below:

Values Description
String In JSON, strings are enclosed in double quotes and there are many special characters like b (backspace), t (tab), etc.
Number JSON supports different number types like integer, fraction and exponential.
Boolean In JSON, true or false value can also be assigned.
Null In JSON, an empty value can be assigned.
svg viewer

Collection of key-value pairs

Here, key-value pairs are always placed between curly brackets ({ }). If there is more than one key-value pair, they are separated by commas.

An ordered list of values

Here, values are enclosed in square brackets ([ ])and each value is separated by a comma…

svg viewer
svg viewer
{
  "Students" : [ 
    { 
      "name" : "Aaron",
      "subject" : "Data structures",
      "age" : 19
      },
    { 
      "name" : "Beck",
      "subject" : "Algorithms",
      "age" : 23 
      },
    { 
      "name" : "David",
      "subject" : "Machine Learning",
      "age" : 28
      }
  ]
}

Note that in the above code snippet, there is an array of Students objects.

RELATED TAGS

json
data structures
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring