We want to make this open-source project available for people all around the world.

Help to translate the content of this tutorial to your language!

BuyEPUB/PDF
Share
back to the lesson

Turn the object into JSON and back

importance: 5

Turn the user into JSON and then read it back into another variable.

let user = {
 name: "John Smith",
 age: 35
};
let user = {
 name: "John Smith",
 age: 35
};
let user2 = JSON.parse(JSON.stringify(user));

AltStyle によって変換されたページ (->オリジナル) /