Copying JSON data to clipboard

There’s currently an option to Download JSON. I’d like another option: Copy JSON to Clipboard.

When working with data that’s generated by an API, sometimes I need to experiment with data structures and field names. It would be great to be able to quickly copy JSON for the current value and use it without needing to interact with the filesystem.

After copying, I might want to…

  • paste it into a new cell and experiment with it more in Observable
  • paste it into my local editor to use complex macros
  • use a command like pbpaste | jq ... to explore it

This is a much needed feature. I was moving to WebStorm to help me understand my code better. Importing was getting a little difficult, so I just wanted to copy-paste the data and use that as-is.

However, that isn’t possible. I was highly disappointed when I didn’t see that option.

This would be a great feature. Maybe as one of the options in the cell’s pop-up menu:

For now, I’m using @mbostock’s suggestion and creating a new cell with a button:

Inputs.button("Copy to clipboard", {
  value: null,
  reduce: () =>

@nachocab Observable has transitioned to GitHub for feature requests. You can find the related issue here:

1 Like