Forum Academy Marketplace Showcase Pricing Features

Editable json via form fields

I’d like the user to be able to edit a JSON string (stored as a field for a thing) via form fields, where each key/value maps to an input box.

More context
I’m planning on using handelbars/mustache to read a json file from a field stored in a thing, and compile the variables into an HTML file. First, however, I’d like to determine if I can allow for a user to edit the JSON via input boxes.

Is the user supposed to actually edit the JSON inline or are they supposed to copy / paste something into those inputs?

If it’s the second, you could just use a regular input that lets you paste the JSON into and store it as text, then later parse it when you need to use it. Not sure if you’ll need to stringify it first - if so you can use the toolbox plugin to take the inputted string and stringify it first/

thanks for the response! was hoping that each input would map to a key/vair pair for the json.

so if I had

"header": "Welcome", 
"button_label": "START HERE"

I could dynamically read the json, and create corresponding input boxes for each keys in the json. so the frontend would have 2 input boxes:

  • header
  • button_label

…which upon saving would write to the json field

anyone have thoughts here?