When developing for the web, sometimes I want to JSONify an object to throw into Sublime Text for an easier look or maybe to compare two separate objects.

While it’s easy to log an object in Google Chrome, the issue I have is easily getting that from the console to Sublime Text.

After doing a bit of searching, I found that Google Chrome has a copy function that will copy any text to the clipboard.

Here are a couple of ways that you could use this function:

To copy any string, simply use

copy( "some string here" );

To copy a JSONified object, you could use something like:

copy( JSON.stringify( object ) );

Let’s stay in touch!

If you liked what you read, then consider filling out the form below and I'll send you an email any time I post about anything WordPress of Development related. You can even choose which lists you're interested in below!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.