Copy To Clipboard As application/json

Hello. I want to allow users to copy Webflow components from my app, so they can paste them into their Webflow sites. Copying and pasting Webflow components only work when the clipboard data type is application/json. I am using a plugin to copy text to clipboard for another use case. But I can’t figure out how to structure the text data in application/json format when copied to clipboard. I also tried a JSON .stringify plugin but the string was not able to be copied to the clipboard.

Does anyone know how this might be possible?

Is the string coming back as null?

Just wondering cause I made that plugin so I want to make sure it’s working right.

It appears that way. I pasted the JSON array into your plugin, created a workflow on button click, added a workflow step with a copy to clipboard plugin, and selected the ID of the JSON.stringify element to paste to clipboard. See attached. Not sure if this is the right way to do this.

Screen Shot 2023-07-05 at 8.41.15 AM
Screen Shot 2023-07-05 at 8.17.26 AM

After clicking the button and paste to the following tool, it appears to be null:

Hey! I’ve just released a patch to make it work as expected. Please let me know if that fixes your problem! :slight_smile:

Ghost Codes’s Tips (bubbleapps.io)

Here is a demo link with the editor link inside!

Thanks @GhostCodes I might’ve been using your plugin for the wrong purpose though. The JSON array is now being copied to clipboard successfully, but the data type is text/plain instead of the application/json that I need… But your plugin might be useful for another use case of mine, so thanks again :slight_smile:

I can make it output as json as too. But the idea was the take JSON data then put it into plain text format (if parsed). What do you need achieved and I’ll add that functionality.

Have you tried the other state as well?

Oh that’s awesome! Basically when I copy a component in Webflow it’s copied to clipboard as application/json… You can see this when I paste the into a clipboard inspector:

Basically, this will JSON will be in plain text format in my Bubble app. Then when the user clicks copy it would be copied to the clipboard in the same format as from Webflow, so the user can then paste the JSON component into their Webflow project.

What other state should I try?

Thanks again and have a great weekend !!

If you’re available now I can push an update that will take your value and return as JSON.

Sure! Ready to test whenever. Just let me know when the update is pushed :slight_smile:

It’s pushed.

Hmmmm it still copies to clipboard as text/plain:

Screen Shot 2023-07-07 at 6.02.43 PM

Is my best bet adding custom code to get the application/json type?

This topic was automatically closed after 70 days. New replies are no longer allowed.