Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
// an object
const John = {
  name: "John Doe",
  age: 23,
};
// convert object to JSON string
// using JSON.stringify()
const jsonObj = JSON.stringify(John);
// save to localStorage
localStorage.setItem("John", jsonObj);
// get the string
// from localStorage
const str = localStorage.getItem("John");
// convert string to valid object
const parsedObj = JSON.parse(str);
console.log(parsedObj);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers