Objects


Objects

The data type of the JSON object is a list of name-value pairs with curly braces.

  • The objects of JSON are substantially like objects of javascript.
  • In key/value pairs, JSON objects are written.
  • Curly braces {} surround the JSON objects.
  • Strings must be keys, and JSON acceptable data type must be valued (string, number, object, array, boolean or null).
  • Colon separation of keys and values.
  • A virus is split from each key/value pair.

Creating Simple Objects

With JavaScript, JSON objects may be produced. See how JSON objects are created with JavaScript .

  • Creation of an empty Object −
    var JSONObj = {};
  • Creation of a new Object −
    var JSONObj = new Object();
  • Creation of a bookname attribute object with string value, number value attribute. Access attribute with '.' Operator –