Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy variable from network tab preview in Chrome Dev Tools

I'm using the Chrome Dev Tools, and I am digging through the network pane to look at an XHR response with the preview tab. I want to grab a specific object from the preview. But when I try to store as global variable by right clicking preview object, the temp variable created was null.

I find that rather strange since the data is in memory (otherwise it wouldn't be displayed at all). Here's an example of a rather large response array that I'm trying to get a specific object from.

Dev Tools

To clarify, I can store a variable that appears in my console. But I can't store a variable from the preview pane of the network tab. Is there any feature of the Chrome Dev Tools I'm overlooking, or am I forced to console log my XHR response and pull the object from there?

I'd really rather not add any console.log() or other breakpoints into my code just to have to remove them later. Digging through the super-long raw JSON response is also not practical. I'm using Chrome 47 on Windows 7.

like image 303
ryanyuyu Avatar asked Dec 30 '15 13:12

ryanyuyu


2 Answers

I can get it to work by going:

  1. Right click on the array index
  2. "Store as global variable"

Then from the console, typing:

copy(temp1);

And then it will be on the clipboard.

enter image description here

like image 189
Thomas Wood Avatar answered Oct 20 '22 15:10

Thomas Wood


Maybe a bit late, but you could go to response tab, copy the response content and then in the console just paste it after :

var response = <<paste here>>

i cant tell by the screenshot but you can then type response.data[64]

like image 1
Illiax Avatar answered Oct 20 '22 15:10

Illiax