<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
var firstData = {
'key1' : 'value1',
'key2' : 'value2'
};
var secondData = {
'key1' : 'value3',
'key2' : 'value4'
};
var myData = JSON.stringify([ firstData, secondData ]);
localStorage.setItem( 'objectToPass', myData );
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
// Get the variable
var myData = localStorage['objectToPass'];
// localStorage.removeItem( 'objectToPass' );
console.log(myData);
</script>
</body>
</html>