10

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.

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
ryanyuyu
  • 6,366
  • 10
  • 48
  • 53
  • I'm voting to close this question as off-topic because it was a bug in Chrome Dev Tools that is now fixed with the latest version. – ryanyuyu Apr 19 '18 at 12:50

2 Answers2

14

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

Thomas Wood
  • 799
  • 7
  • 12
1

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]

Illiax
  • 1,002
  • 1
  • 8
  • 21
  • This is at least somewhat a workaround. It's not perfect because the dev tools seems to lag out when handling an object of that massive size, but at least I am able to specify an index and manipulate the individual piece of the giant array. – ryanyuyu Jan 13 '17 at 20:14
  • @ryanyuyu you're right. Today i've the exact same issue with a response data. I was unable to paste it so i loaded jquery into the console and request the file manually. But this is not the ideal solution :( – Illiax Jan 16 '17 at 16:54