Copy JS objects from chrome console window


 Copy JS objects from chrome console window


Right-click the JS object in Chrome’s console and select “Store as Global Variable” from the context menu.
This Generate and Return a Global Variable with JS object as Result with name something like temp1

1. Copy JS object result on Clip Board
Use Chrome copy() method, as below

//Open Notepad, Edit > Paste / Ctrl + V


2. Generate a JSON file with Result of JS object
Copy and paste below code in chrome console and hit enter

(function(console){ = function(data, filename){
  if(!data) {
     console.error(' No data')

  if(!filename) filename = 'console.json'

  if(typeof data === "object"){
    data = JSON.stringify(data, undefined, 4)

  var blob = new Blob([data], {type: 'text/json'}),
  e = document.createEvent('MouseEvents'),
  a = document.createElement('a') = filename
  a.href = window.URL.createObjectURL(blob)
  a.dataset.downloadurl =  ['text/json',, a.href].join(':')
  e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)


Now use the function for downloading, by typing following code in Chrome Console and hit enter;

// This generate and a JSON file with JS object as result for Download


More on Java Script …

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Be the first to comment

Leave a Reply

Your email address will not be published.


4 × 2 =