Chrome Console Copy JSON Array or Object as String to Clipboard

Very simple task but I had to spend some time finding an answer online and could not find it.

I use heavily Google Chrome for frontend  development

I tried different approaches $.ajax post and then copy the post data, it works but long process.

The best way to copy json array or object to clipboard is by running following command in Google Chrome Console.

chrome console copy json array or object as string to clipboard

copy(JSON.stringify(YOUR_JSON_ARRAY_OR_OBJECT));

This will do the following convert the json array or object to a string to copy it to your clipboard.

Hope that helps,

3 Comments

  1. Alex Coroza

    I cant make it run at first but its ok now. First is right click the object/array in your console then saved it as global variable then a variable name will be given below(temp1 for example) then copy(JSON.stringify(temp1)). Again, thanks because this is a big help.

Leave a Reply

Your email address will not be published. Required fields are marked *