Important Points to Remember: JSON rules

by | Dec 25, 2020 | JSON

Home » Website Development » JSON » Important Points to Remember: JSON rules

Table of Contents

JSON rules

  • To access JSON data that is parsed as a JS object into a variable in JavaScript, we use dot/bracket notation as shown below.
    access JSON data
  • To drill down further, we need to chain the required property name with the required index of the array together. This is explained below:
    Access JSON Array
    Note: All codes are written directly into the console of a browser so that, instantly an error can be identified.
  • It is mandatory to use double quotes [single quotes are not valid] around strings and property names in JSON.
  • Even a single comma can cause a JSON file to go wrong. Therefore, it is very important to use a JSON validator, before passing JSON to our code. A JSON validator like jsonlint.com, helps us to identify errors within our JSON code.

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Author