Create JSON key and value from 2 form fields

Posted 3 years ago by domioanna

I'm utilising the JSON field type in Laravel, but I'm trying to allow the user to fill in a form whereby there would be a row of 2 input fields, whatever they enter in the first field will become the key and the second field would become the value, creating a key => value pair, saving to the database in a JSON format.

Then if the user wants to add another row, they would click a button to add another row.

I don't suppose anyone has any ideas on how I could achieve this?

Using Laravel 5.1, along with Illuminate's HTML / Form facade. Also utilising jQuery if that offers up any solutions.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.