Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Working with JSON | Section
JavaScript Essentials for Backend

bookWorking with JSON

Deslize para mostrar o menu

JSON is a format used to store and transfer data.

It looks similar to JavaScript objects, but it is always written as a string.

const jsonString = '{"name": "John", "age": 25}';

To work with JSON in JavaScript, you need to convert it.

To convert JSON into a JavaScript object, use JSON.parse:

1234
const jsonString = '{"name": "John", "age": 25}'; const data = JSON.parse(jsonString); console.log(data.name);
copy

To convert a JavaScript object into JSON, use JSON.stringify:

1234
const user = { name: "John", age: 25 }; const json = JSON.stringify(user); console.log(json);
copy
question mark

What does JSON.parse() do?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 18

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 18
some-alt