Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The process to create the key value pair using object notation is as follows:

  1. Start with an opening curly brace "{"
  2. Add the "key" followed by a colon ":" and then the "value"
  3. Separate each key-value pair with a comma ","
  4. End the object by adding a closing curly brace "}"

Example:

{
  "name": "John",
  "age": 30,
  "isStudent": true,
  "hobbies": ["reading", "writing", "playing guitar"]
}

In the above example, "name", "age", "isStudent" and "hobbies" are the keys and "John", 30, true and ["reading", "writing", "playing guitar"] are the corresponding values.