Discuss about different JSON data types.

This answer is restricted. Please login to view the answer of this question.

Login Now

JSON (JavaScript Object Notation) is the most widely used data format for data interchange on the web. JSON is a lightweight text-based, data-interchange format and it is completely language-independent. It is based on a subset of the JavaScript programming language and it is easy to understand and generate.

JSON supports mainly 6 data types:

  1. string
  2. number
  3. boolean
  4. null
  5. object
  6. array

1. String:

Strings in JSON must be written in double quotes.

{"name":"John"}

2. Number:

Numbers in JSON must be an integer or a floating point.

{"age":30}

3. Boolean:

Values in JSON can be true/false.

{"sale":true}

4. null:

Values in JSON can be null.

{"middlename":null}

5. Objects:

Values in JSON can be objects.

{
    "employee":{"name":"John""age":30"city":"New York"}
}

6. Array:

Values in JSON can be arrays.

{
    "employees":["John""Anna""Peter"]
}

If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .