How To Get Data From [Object Object]

In this tutorial, we will be discussing how to get data from an object in JavaScript. This is a common task when working with data that is typically in the JSON format.

We will be covering different methods to access this data, such as dot notation and bracket notation. By the end of this tutorial, you should be well-equipped to fetch various data properties from JavaScript objects.

Step 1: Define an Object

First and foremost, we need to define an object from which we want to fetch the data. In this tutorial, we will be using the following object:

    "name": "John Doe",
    "age": 35,
    "address": {
        "streetAddress": "21 2nd Street",
        "city": "New York",
        "state": "NY",
        "postalCode": "10021"

Step 2: Use Dot Notation to Access Object Properties

We can use the dot notation to access properties in JavaScript objects. To do this, you simply follow the variable name with a period and the property’s name. Some examples are below:

Step 3: Use Bracket Notation to Access Object Properties

Another way to access properties in a JavaScript object is by using bracket notation. To do this, you enclose the property name in square brackets and place them immediately after the object variable name. Here are some examples using the same person object:

Bracket notation is especially helpful when you want to access properties with special characters in their names or access properties dynamically using a variable. For example:

Full Code:


In this tutorial, we showed how to get data from JavaScript objects using both dot notation and bracket notation. These methods are fundamental when working with JSON data or accessing properties in JavaScript objects. With this knowledge, you should now be able to efficiently extract information from those objects.