When we console.log()
some data that's in the form of an object or an array, it's hard to copy and paste the results from Chrome's console. If you try and highlight what's there, you'll just end up with something like Array(3)
when you paste, instead of the actual data.
I just learned this easy method of copying things out of Chrome's console.
When you see the data in the console, right click on it to store as global variable.
Chrome will store it as a temporary variable called temp1
Once you have your variable, just use the copy()
function.
copy(temp1)
Hit enter and you'll see undefined
right below it, which is normal.
Now you'll have all the data in your clipboard, just paste it anywhere you like!
[
{
"data": "data for res #1"
},
{
"data": "data for res #2"
},
{
"data": "data for res #3"
}
]
Top comments (5)
It won't work always. For complex array of objects it will return as [object Object],[object Object],[object Object],[object Object].
copy(temp1.toArray())
You can just create a quick map of the complex object and it will spit them out :O)
so how can we copy it.. is there anybody knows?
Thanks for the post. There's now an option to "Copy object" in Chromium's dev tools. 👌