mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-02 07:01:28 -04:00
fix(curriculum): change "assert" to "from" and remove videoId (#61446)
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
---
|
||||
id: 6732b788046862264eeb1c39
|
||||
title: What Is JSON, and How Do You Access Values Using Bracket and Dot Notation?
|
||||
challengeType: 11
|
||||
videoId: 8x6vJarVy_o
|
||||
challengeType: 19
|
||||
dashedName: what-is-json-and-how-do-you-access-values-using-bracket-and-dot-notation
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Watch the video or read the transcript and answer the questions below.
|
||||
|
||||
# --transcript--
|
||||
|
||||
What is JSON and how do you access values using bracket and dot notation?
|
||||
|
||||
JSON stands for JavaScript Object Notation. It is a lightweight, text-based data format that is commonly used to exchange data between a server and a web application.
|
||||
@@ -38,7 +33,7 @@ As you can see, JSON uses key-value pairs to store information and each pair is
|
||||
To access data from a JSON object, you can either use dot or bracket notation. In this example, we are using dot notation to access the `age` from the JSON object:
|
||||
|
||||
```js
|
||||
import data from "./example.json" assert { type: "json" };
|
||||
import data from "./example.json" with { type: "json" };
|
||||
|
||||
console.log(data.age);
|
||||
```
|
||||
@@ -48,7 +43,7 @@ This particular example is using what is known as an `import` statement, which i
|
||||
You can also use bracket notation to access information from JSON objects. Here is an example of accessing the `list of courses` array:
|
||||
|
||||
```js
|
||||
import data from "./example.json" assert { type: "json" };
|
||||
import data from "./example.json" with { type: "json" };
|
||||
|
||||
console.log(data["list of courses"]);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user