JSON encoding in plugin

Hello,

I’ve seen several discussions around that topic, which seem to say there is no solution, but I don’t want to believe I’m the only one facing the problem.
I have endpoints that require to POST/PUT json body. In my plugin, I set the body with some variables, like
{ "variableA": "<variableA>", "variableB": "<variableB>" }
In Bubble, when I use my plugin, I set variableA and variableB as content from user inputs.
Problem is now that variableA and variableB are not json encoded, thus the plugin calls our API with an invalid JSON.

Does anyone has a solution around it (other than say that each call to an endpoint should call another endpoint to encode the parameters as I don’t think this solution is really a sustainable solution)?
Thanks in advance for your help!

P.S.: more generally, is there anyway to write some code to generate the json instead of using the visual editor? That would be awesome and solve many of my problems, like JSON encoding, optional parameters, names in the endpoint not readable in the plugin usage box as too long, …

Is this what you’re looking for?

You can avoid that by putting code in a preformatted text. Just select the text and click on the </>, in the editor toolbar.

Hey!

Thanks for the quick reply.
Actually, that plugin would do the job. However, it is a big burdain … I want people to be able to use my plugin easily, not have them need to use another plugin before calling mine + to know the JSON format of my api. Ideally, I have some parameters taken by my plugin, and it is my responsibility to use these inputs to call my endpoint, not their. If they have to create a json and call me, I don’t really see the use of my plugin, they could just make api calls directly …