JSON Data type


JSON Data type

JSON format extends support for the below-mentioned data types:

Sr.No. Type & Description
1 Number
JavaScript’s format of floating point with double precision
2 String
Unicode that is double quoted with backslash based escaping
3 Boolean
True / false
4 Array
Values’ ordered sequence
5 Value
May be a number, a string, true / false, null value, etc.
6 Object
key:value pairs’ ordered collection
7 Whitespace
May be used between any token pairs
8 null
empty

Number

  • The floating point format in JavaScript is double precision and depends on implementation.
  • No hexadecimal and octal formats are used.
  • Number does not employ NaN or Infinity.
Sr.No. Type & Description
1Integer
Digits 1 to 9, 0 and both positive and negative ones
2Fraction
Fractions, including .3, .9, etc.
3Exponent
Exponents such as e, e-, e+, E, E-, E+, etc.

String

  • The Unicode characters with a backslash escape is zero or more double-cited.
  • Character is a single string, i.e. a longitudinal string 1.
Sr.No. Type & Description
1 "
double quotation
2 \
backslash
3 /
forward slash
4 b
backspace
5 f
form feed
6 n
new line
7 r
carriage return
8 t
horizontal tab
9 u
four hexadecimal digits

Boolean

  • It contains true or false values.

Array

  • The value collection is ordered.
  • The square brackets are included, which signifies that the array begins at.[ and finishes with.].
  • Separation of the values by (comma).
  • The indexing of the array may commence at 0 or 1.
  • When key names are sequential integers, arrays should be used.

Object

  • The set of names/value pairs is an unordered set.
  • Objects are embedded in curly braces, which means that they begin with '{' and end with '}.'
  • The '(colon) and the key / value pairs separate by ' are followed by each name; (comma).
  • The keys should be strings and be varied.
  • When key names are arbitrary strings, objects should be utilized.

Whitespace

  • It is possible to insert between any tokens pair. To make a code more readable, it can be included. An example is a statement with and without whitespace –

null

  • It means empty type.

JSON Value

It includes −

  • number (integer or floating point)
  • string
  • boolean
  • array
  • object
  • null