Adding a string to the JSON body with a text input

I am using an API to be able to track packages with the waybill number, in the request json I can put several waybills separated by comma, what I want to know is if I can add more strings to that part by means of a text input, and I mean add, not replace.

Hey @Juan_Carlos_Ortiz! You should definitely be able to.

In this example, I set my JSON explorer to reference a temporary state variable (variable1) like this:

Then, in my text input (textInput1), I added an event handler to add the input value to the temporary state on submit (or hitting enter):

If you want the text input to clear after submit you could add an event handler like this!

Let me know how this works for you or if you have any questions at all!

Hi! I tried to do it this way but instead of adding new strings all the new waybills were joined to the same string.

Sin título

I put the JSON body like this

Hey @Juan_Carlos_Ortiz!

Can you try passing in

"string": {{variable1.value}}

instead of

"string" : [
  "{{variable1.value}}"
]

Note that this only works if you declare your temporary state as an array to start. Curious to know how you currently have it configured :thinking: